Advertisement
Josif_tepe

Untitled

Mar 18th, 2021
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     int fact[n];
  10.     fact[0] = 1;
  11.     fact[1] = 1;
  12.     for(int i = 2; i <= n; i++) {
  13.         fact[i] = fact[i - 1] * i;
  14.     }
  15.     cout << fact[n] << endl;
  16.     return 0;
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement