C Program to calculate product of digits.

Sample Input 1 :

734

Sample Output 1 :

84 (7*3*4)

Flow Chart Design

C Program to calculate product of digits. Flow Chart

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

#include<stdio.h> int main() { //write your code here }

Program or Solution

				
			
					
#include<stdio.h>
int main()
{
	int num,sum;
	scanf("%d",&num);
	while(num!=0)
	{
		sum+=num%10;
		num/=10;
	}
	printf("sum is %d",sum);
	return 0;
}
		
			
				
			

Output

C Program to calculate product of digits. Output

Program Explanation

refer video tutorial

Comments