Skip to content

Commit d03f288

Browse files
authored
Factorial.c
This solves #623
1 parent 63b8d0c commit d03f288

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Factorial.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
int c, n, fact = 1;
6+
7+
printf("Enter a number to calculate its factorial\n");
8+
scanf("%d", &n);
9+
10+
for (c = 1; c <= n; c++)
11+
fact = fact * c;
12+
13+
printf("Factorial of %d = %d\n", n, fact);
14+
15+
return 0;
16+
}

0 commit comments

Comments
 (0)