#include<stdio.h>
main()
{
int number, factorial, temp;
printf("Enter the number whose factorial is to be calculated:");
scanf ("%d", &number);
temp=1;
factorial=1;
while (temp <= number)
{
factorial=factorial*temp;
temp++;
}
printf("The factorial of the entered number is:%d", factorial);
}
No comments:
Post a Comment