Advertisement
Guest User

q

a guest
Dec 7th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <cmath>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7. long int C(int k, int n)
  8. {
  9. if(k==n) return 1;
  10. if(k==0) return 1;
  11. return C(k-1, n-1) + C(k,n-1);
  12. }
  13.  
  14. int main()
  15. {
  16. int n, k;
  17. while(true){
  18. cout << "Vvedite k: ";
  19. cin >> k;
  20. cout << "Vvedite n: ";
  21. cin >> n;
  22. cout << "Result: ";
  23. cout << C(k, n);
  24. cout << endl;
  25. cout << "Next one..." << endl;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement