Mim527

11.Factorial

May 28th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.18 KB | None | 0 0
  1. #include<stdio.h>
  2. main()
  3. {
  4. int f,i,n;
  5. printf("Enter a positive number:");
  6. scanf("%d",&n);
  7. f=1;
  8. for(i=1;i<=n;i=i+1)
  9. {
  10. f=f*i;
  11. }
  12. printf("the factorial is = %d",f);
  13. return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment