fork download
  1. #include <iostream>
  2.  
  3. int exponential( int x ){
  4. int result = 1;
  5. for( int i = 2; i <= x; i++ ){
  6. result *= i;
  7. }
  8. return result;
  9. }
  10.  
  11. int main(){
  12. for( int x = 1; x <= 20; x++ ){
  13. std::cout << exponential(x) << std::endl;
  14. }
  15. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1
2
6
24
120
720
5040
40320
362880
3628800
39916800
479001600
1932053504
1278945280
2004310016
2004189184
-288522240
-898433024
109641728
-2102132736