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