Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<stdio.h>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int Calculate(int n, int k){
  6.  
  7. if(k == 0) return 1;
  8. return (n * Calculate(n - 1, k - 1)) / k;
  9. }
  10.  
  11. int main()
  12. {
  13. int n;
  14. int k;
  15. printf("Insert n:");
  16. cin >> n;
  17. printf("Insert k:");
  18. cin >> k;
  19. printf("Value of C is %d ", Calculate(n, k));
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement