Thursday, 16 February 2017

Product of digit

Q : Write a program to calculate product of digit of a given page ?

Solution : 

class product
{
void get_sum(int n)
{
int i,sum=1,d;
while(n>0)
{
d=n%10;
sum=sum*d;
n=n/10;
}
System.out.println("Product of each digit is " + sum);
}

}