Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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

#include<iostream>

using namespace std;

int main()
{
	int number, reminder, digitProduct = 1;
	
	cout << "
Please Enter the Number to find the Digits Product =  ";
	cin >> number;
	
	while (number > 0)
	{
    	reminder = number % 10;
    	digitProduct = digitProduct * reminder;
    	number = number / 10;
    	
    	cout << "
Digit = " << reminder << " and the Digit Product = " << digitProduct;
	}
	cout << "

The Product of all Digits in a given Number = " << digitProduct;
		
 	return 0;
}
Source by www.tutorialgateway.org #
 
PREVIOUS NEXT
Tagged: #find #product #numbers
ADD COMMENT
Topic
Name
7+8 =