Ghislain_Mike

factorial

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