Question: c programming 5 FUNCTION REQUIREMENTS The source file you submit should contain the following functions: unsigned int SumOfDigits(unsigned int n) Description: Develop a function that
5 FUNCTION REQUIREMENTS The source file you submit should contain the following functions: unsigned int SumOfDigits(unsigned int n) Description: Develop a function that takes a non-negative integer n as a parameter and returns a non-negative integer containing the sum of n's digits. For example, if the input parametern was 17239 then the output of this function should be 1 +7 +2+3+9 = 22 Example input: n = 17239 Example output: 22 void PrintDivisors(unsigned int n) Description: Develop a function that takes a non-negative integer n and prints out all its divisors, that is all numbers m between 1 and n (including those) such that n is divisible by m. The divisors should be printed out in the increasing order. Example input: n = 3150 Example output: Divisors of 3150: 1, 2, 3, 5, 6, 7, 9, 10, 14, 15, 18, 21, 25, 30, 35, 42, 45, 50,63, 70, 75, 90, 105, 126, 150, 175, 210, 225,315, 350, 450, 525, 630, 1050, 1575, 3150 unsigned long GetBinomial coefficient(unsigned int n, unsigned int m) Description: Develop a function that takes two positive integers n and m (n2 m) as parameters and returns their binomial coefficient: n! m! (n-m)! Note that the factorial of n is equal to n! = 1.2-3...(n-1)-n, and also 0! = 1. Example input: n = 5, m=2 Example output: 10 Hint: Take a look at the factorial example from class BONUS QUESTION (20 extra points): Can you do better without computing three factorials? Look at the formula above and see how you can optimize computations (which will also reduce the possibility of overflow for the output type unsigned long)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
