fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int fact(int n)
  5. {
  6. if(n==0) return 1;
  7. int ans=n*fact(n-1);
  8. return ans;
  9. }
  10. int main()
  11. {
  12. int n;
  13. cin>>n;
  14. int ans=fact(n);
  15. cout<<ans<<endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
0