fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. long long int fact(int n)
  6. {
  7. if(n==0)
  8. return 1;
  9. return n*fact(n-1);
  10. }
  11.  
  12. int main()
  13. {
  14. int n;
  15. scanf("%d",&n);
  16. long long int ans=fact(n);
  17. cout<<ans<<"\n";
  18. return 0;
  19. }
Success #stdin #stdout 0s 2732KB
stdin
5
stdout
120