Advertisement
skb50bd

Array Factorial

Apr 18th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int n,m,i,fact=1;
  5.    
  6.     printf("Input the Number: ");
  7.     scanf("%d",&n);
  8.    
  9.     int ara[n];
  10.    
  11.     for(m=n, i=0 ; i<n ; i++, m--)
  12.         ara[i]=m;
  13.        
  14.     for(i=0 ; i<n ; i++)
  15.         fact*=ara[i];
  16.        
  17.     printf("%d! = %d",n,fact);
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement