(a) Write a function choose fac(n,k) that computes
(n)
(k)
according to Denition (1), i.e., using n!
Hint: First dene a function fact(n) that takes an integer n and returns n! as the result of the function.
You can use the code from class, e.g., the one that computes n! recursively (n! = n (n 1)! for integers
n 1, and n! = 1 for n = 0), or the one that works iteratively (i.e., using n! = 1 2 : : : n).
(
(n)
(k)
according to Denition (2), i.e., recursively.
I don't quite understand recursion but I managed to do the program. How do I make it so that the program prints out in a triangle format?
Thanks

New Topic/Question
Reply



MultiQuote




|