Advertisement
sujonshekh

Recursion with Function

Aug 12th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include<stdio.h>
  2. int factorail(int n)
  3. {
  4.     if(n==1)
  5.     return 1;
  6.     else
  7.         return n*factorail(n-1);
  8. }
  9.  
  10. int main()
  11. {
  12.     int n;
  13.     scanf("%d",&n);
  14.     factorail(n);
  15.     printf("Factorail = %d",factorail(n));
  16.  
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement