Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Please, Don't Miss Visit My Site:
- https://global-prog.com
- */
- #include<iostream>
- using namespace std;
- int factorial(int x) {
- if (x == 0) {return 1;}
- else { return (x * factorial(x - 1)); }
- }
- int main()
- {
- int x;
- cout << "Enter the number to take the factorial : ";
- cin >> x;
- cout << x << "! = " << factorial(x) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement