Create c program

c program to find factorial of number
This commit is contained in:
Pradeep Kumar Gupta 2020-10-01 19:23:31 +05:30 committed by GitHub
parent 1fe2b008cd
commit 59b976116d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

15
c program Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
int main()
{
int c, n, f = 1;
printf("Enter a number to calculate its factorial\n");
scanf("%d", &n);
for (c = 1; c <= n; c++)
f = f * c;
printf("Factorial of %d = %d\n", n, f);
return 0;
}