fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int factorial(int N) {
  5.  
  6. if (N == 0)
  7. return 1;
  8. else
  9. return N * factorial(N - 1);
  10.  
  11. }
  12.  
  13. int main() {
  14.  
  15. cout << "10! = " << factorial(10) << endl;
  16. return 0;
  17.  
  18. }
Success #stdin #stdout 0.01s 5520KB
stdin
Standard input is empty
stdout
10! = 3628800