in c++ wap to input a number and print the product of it's digits using while loop programs
Answers
Answered by
0
Answer:
C++ programming
Explanation:
// C++ program to compute
// product of digits in the number.
#include<bits/stdc++.h>
using namespace std;
/* Function to get product of digits */
int getProduct(int n)
{
int product = 1;
while (n != 0)
{
product = product * (n % 10);
n = n / 10;
}
return product;
}
// Driver program
int main()
{
int n = 4513;
cout << (getProduct(n));
}
Similar questions
English,
1 month ago
Biology,
1 month ago
Math,
2 months ago
Social Sciences,
2 months ago
English,
9 months ago