Skip to content

Commit

Permalink
Factorial.c
Browse files Browse the repository at this point in the history
This solves #623
  • Loading branch information
Raman1309 authored Oct 26, 2019
1 parent 63b8d0c commit d03f288
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Factorial.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>

int main()
{
int c, n, fact = 1;

printf("Enter a number to calculate its factorial\n");
scanf("%d", &n);

for (c = 1; c <= n; c++)
fact = fact * c;

printf("Factorial of %d = %d\n", n, fact);

return 0;
}

0 comments on commit d03f288

Please sign in to comment.