#include <stdio.h>
int main()
{
int a, n;
int fact = 1;
printf("Enter a number to calculate it's factorial\n");
scanf("%d", &n);
for (a = 1; a <= n; a++)
fact = fact * a;
printf("Factorial of %d = %d\n", n, fact);
return 0;
}
int main()
{
int a, n;
int fact = 1;
printf("Enter a number to calculate it's factorial\n");
scanf("%d", &n);
for (a = 1; a <= n; a++)
fact = fact * a;
printf("Factorial of %d = %d\n", n, fact);
return 0;
}
No comments:
Post a Comment