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