Advertisement
aj423

Factorial

Oct 20th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n,i,f=1;
  5. scanf("%d",&n);
  6. if(n==0)
  7. {
  8. printf("Factorial= 0\n");
  9. }
  10. else{
  11.  
  12. for(i=1;i<=n;i++)
  13. {
  14. f=f*i;
  15.  
  16. }
  17. printf("Factorial= %d\n",f);
  18. }
  19.  
  20.  
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement