Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int fact(int n)
- {
- if(n < 0)
- return 0;
- if (n == 0)
- return 1;
- else
- return n * fact(n - 1);
- }
- int main()
- {
- int n = 6;
- int m = 4;
- int answer;
- answer = (fact(n))/(fact(n-m));
- cout << "Factorial: " << " = " << answer << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement