Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int fact[n];
- fact[0] = 1;
- fact[1] = 1;
- for(int i = 2; i <= n; i++) {
- fact[i] = fact[i - 1] * i;
- }
- cout << fact[n] << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement