fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // input
  6. int n;
  7. cin >> n;
  8.  
  9. // process
  10. long long factorial = 1;
  11. for (int i = 1; i <= n; i++) {
  12. factorial = factorial * i;
  13. }
  14.  
  15. // output
  16. cout << factorial;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5300KB
stdin
1 2
stdout
1