Write a program to find the factorial value of any number entered through the keyboard.
main()
{
unsigned int f=1;
int num,i;
printf("Enter any number to calculate its factorial value :- ");
scanf("%d",&num);
i=num;
while(i>0)
{
f=f*i;
i--;
}
printf("Factorial of %d is %u.",num,f);
getch();
}
No comments:
Post a Comment