Advertisement
dartwlad

1_9

Feb 20th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int fact(int n)
  4. {
  5.     if(n < 0)
  6.         return 0;
  7.     if (n == 0)
  8.         return 1;
  9.     else
  10.         return n * fact(n - 1);
  11. }
  12.  
  13. int main()
  14. {
  15.     int n = 6;
  16.     int m = 4;
  17.     int answer;
  18.     answer = (fact(n))/(fact(n-m));
  19.     cout << "Factorial: " << " = " << answer << endl;
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement