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