Shishu

factorial number in c

Nov 16th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6.   int c, n, fact = 1;
  7.  
  8.   printf("Enter a number to calculate it's factorial=");
  9.   scanf("%d", &n);
  10.  
  11.   for (c = 1; c <= n; c++)
  12.     fact = fact * c;
  13.  
  14.   printf("Factorial of %d = %d\n", n, fact);
  15.  
  16.   return 0;
  17. }
Add Comment
Please, Sign In to add comment