Showing posts with label Product of Digits. Show all posts
Showing posts with label Product of Digits. Show all posts

Write a Program to print Product of Digits (eg. 212=2*1*2=4) of a given number

#include<stdio.h>
#include<conio.h>

void main()
{
int no,r,pt=1;
clrscr();
printf("Enter a no:");
scanf("%d",&no);
while(no>0)
{
r=no%10;
pt=pt*r;
no=no/10;
}
printf("Product of Digits= %d",pt);
getch();
}

Related Post

Array:
String functions:
General (Loops-for/while)
Write a Program to print reverse of a given number Write a Program to print Product of Digits (eg. 212=2*1*2=4) of a given number Write a C++ Program to Convert Binary into Decimal Number