Question: The Choose Function is defined by factorial functions as follows, $ n / choose $$ = Ifrac { n ! } { k ! (

The Choose Function is defined by factorial functions as follows, $ n/choose $$=
Ifrac{n!}{k!(n-k)!}$, when k1, or 1 when k=0.
a) Write a factorial function using a for loop to calculate n! where the function take n
as an argument. (See page 76 for an example.)
b) Check that your factorial function works with n=4,5 and 6.
c) Write a choose function that takes n and k as arguments. This function should
use multiple calls to your factorial function to calculate the Choose Function.
d) Upgrade your factorial fuction using the recursion method in Exercise 2.13. Make
sure to give it a different name than your factorial function from part a).
The Choose Function is defined by factorial

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!