Answers for "how to find product of a given numbers in c++"

C++
0

how to find product of a given numbers in c++

#include<iostream>

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;
}
Posted by: Guest on June-24-2021

Code answers related to "how to find product of a given numbers in c++"

Browse Popular Code Answers by Language