Question: Using the recursive factorial function from Lecture 5, write a program that calculates n choose r' Firstly, prompt the user to enter two long long
Using the recursive factorial function from Lecture 5, write a program that calculates "n choose r'" Firstly, prompt the user to enter two long long unsigned int numbers, n and r. Do this by printing the string, "Setting combination parameters, select n and r: ". To scanf a long long unsigned int use "%11u", use the same %11u" for printing. The factorial function must be adjusted to return a long long unsigned int as well as accept a long long unsigned int as an argument. The program must make sure that n is less than 20, and that r is less than n. If either of those conditions are not met (n greater than 20 or r greater than n), print the string "Error: n is greater than 20 or r is greater than n. |n". Follow the equation: Q3) Tl. The combination calculation should be inside a function with the prototye: long long unsigned int combination(long long unsigned int n, long long unsigned int r); The program should print the answer. A sample output is shown below: Setting combination parameters, select n and r: 10 2 45 or setting combination par eters, select n and r: 12 6 Setting combination pareters, select n and r: 24 12 Note: There are still NO double spaces. Name your file combinations.c 924 or Error: n is greater than 20 or r is greater than n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
