Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The expression C(n,r) denotes the number of r-element subsets of an n-element se

ID: 3617495 • Letter: T

Question

 The expression C(n,r) denotes the number of r-element subsets of an n-element set.
For example, C(4,2) is 6 because there are six 2-element subsets of a 4-element set.
The value of C(n,r) is given by the formula

c(n,r) = n! / ( r! * (n-r)! )

Write a program that computes C(n,r) using the following component functions.

(a) main: prompts the user for two numbers and accents them into n and r, respectively.
(b) check: compares r and n. If r > n, check invokes the function err_msg,
which prints an appropriate error message.
(c) comb: computes C(n,r).
(d) fact: computes factorial.

Expected Output:

(i)
Enter n in C(n,r) : 4
Enter r in C(n,r) : 7
n must be greater than or equal to r in C(n,r)

(ii)
Enter n in C(n,r) : 5
Enter r in C(n,r) : 2
10

(iii)
Enter n in C(n,r) : 25
Enter r in C(n,r) : 20
53130

(iV)
Enter n in C(n,r) : 52
Enter r in C(n,r) : 48
270725

Explanation / Answer

please rate - thanks #include using namespace std; void err_msg(); double comb(int,int); double fact(int); int main() {unsigned int n,r,; coutn; coutr; if(r>n)     {err_msg();     system("pause");     return 0;     } cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote