/**************************************************
Program to find the product of digits of a number
*
* Enter a number: 456
* 120
**************************************************/
#include<stdio.h> // include stdio.h library
int main(void)
{
int num, rem, prod = 1;
printf("Enter a number: \n");
scanf("%d", &num);
while(num != 0)
{
rem = num % 10; // get the right-most digit
prod *= rem; // calculate product of digits
num /= 10; // remove the right-most digit
}
printf("%d", prod);
return 0; // return 0 to operating system
}