5. Write a function to compute the following where C(n, i) is the number of ways
ID: 647088 • Letter: 5
Question
5. Write a function to compute the following where C(n, i) is the number of ways to select i items out of n items. Assume that the following function is already written, tested and available for you to use and that it computes C(n, i). long combination(int n, int i) The first line of the function to compute the summation is given below. Complete the rest of the function. This function computes only the summation using the equation above. Assume that n has been sent into the function sumofcomination from some other function (so you don't need to get it from the user). long sumofcombination(int n){Explanation / Answer
long sumofcombination(int n){
long sum = 0;
for(long i = 0; i <= n; i++){
sum += combination(n, i);
}
return sum;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.