Advertisement
saira12tabassum19

Untitled

Jul 1st, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement