fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. long int silnia(int n) {
  5. if (n ==0) return 1;
  6. return silnia(n - 1) * n;
  7.  
  8. }
  9.  
  10. int main() {
  11. for (int i = 0; i < 21; i++)
  12. cout << i << " " << silnia (i) << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
0 1
1 1
2 2
3 6
4 24
5 120
6 720
7 5040
8 40320
9 362880
10 3628800
11 39916800
12 479001600
13 6227020800
14 87178291200
15 1307674368000
16 20922789888000
17 355687428096000
18 6402373705728000
19 121645100408832000
20 2432902008176640000