Advertisement
tonygms3

Question 14 Assignment

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