Advertisement
LEGEND2004

B - Factorial

Aug 31st, 2023
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define int long long
  5.  
  6. int n;
  7. int f[25];
  8.  
  9. signed main()
  10. {
  11.     cin >> n;
  12.     f[0] = 1;
  13.     for(int i = 1; i <= n; i++){
  14.         f[i] = f[i - 1] * i;
  15.     }
  16.     cout << f[n] << endl;
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement