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