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