Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <cmath>
- #include <cstdlib>
- using namespace std;
- long int C(int k, int n)
- {
- if(k==n) return 1;
- if(k==0) return 1;
- return C(k-1, n-1) + C(k,n-1);
- }
- int main()
- {
- int n, k;
- while(true){
- cout << "Vvedite k: ";
- cin >> k;
- cout << "Vvedite n: ";
- cin >> n;
- cout << "Result: ";
- cout << C(k, n);
- cout << endl;
- cout << "Next one..." << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement