📌  相关文章
📜  如何在 C++ 代码示例中找到给定数字的乘积

📅  最后修改于: 2022-03-11 14:44:58.600000             🧑  作者: Mango

代码示例1
#include

using namespace std;

int main()
{
    int number, reminder, digitProduct = 1;
    
    cout << "\nPlease Enter the Number to find the Digits Product =  ";
    cin >> number;
    
    while (number > 0)
    {
        reminder = number % 10;
        digitProduct = digitProduct * reminder;
        number = number / 10;
        
        cout << "\nDigit = " << reminder << " and the Digit Product = " << digitProduct;
    }
    cout << "\n\nThe Product of all Digits in a given Number = " << digitProduct;
        
     return 0;
}