Advertisement
AquaBlitz11

[t001] factorial

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