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