/*find the product of digits */
#include<stdio.h>
#include<conio.h>
void main()
{
int rem,prod=1,n;
clrscr();
printf("Enter a integer :");
scanf("%d",&n);
while(n>0)
{
rem=n%10;
prod*=rem;
n/=10;
}
printf("factorial %d",prod);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int rem,prod=1,n;
clrscr();
printf("Enter a integer :");
scanf("%d",&n);
while(n>0)
{
rem=n%10;
prod*=rem;
n/=10;
}
printf("factorial %d",prod);
getch();
}
No comments:
Post a Comment