Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I understand this code except for the part where it needs to end the program if the number is not in the range after printing

I understand this code except for the part where it needs to end the program if the number is not in the range after printing the error message. image text in transcribed
marks People Window Help Assignments-2181,23417 xy D Problem, set-2(4).pdf uffalo.edu/bbcswebdav/pid-44968 23-dt-content-rid-18 1426903/courses/2181-234 17/Problem-Set.2%28 Q3) 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 paraneters, select n and r: ". To scanf a long long unsigned int use %11u", use the sanne alu" 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 NOT greater 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", and end the program (do NOT ask the user for a new input). Follow the equation: The combination calculation should be inside a function with the prototye: long long unsigned int combination(long long unsigned int a, 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 parameters, select n and T: 12 6 924 or Setting combination parameters, select n and r: 24 12 Error: n is greater than 20 or r is greater than n Note: There are still NO double spaces. Name your file combinations.c

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1-4 How will MIS help my career?

Answered: 1 week ago