Question: code in C and provide a screenshot of the code Question 2 [25 points] Write a recursive function named RecPower that takes two positive integers
Question 2 [25 points] Write a recursive function named RecPower that takes two positive integers x and n as input parameters and recursively computes and returns the value of x". The function takes advantage of the fact that x= x2 * xon2 to break each power n down into two equal or nearly equal powers: n/2 and n-n/2 (if n is odd the two powers will not be exactly equal). The function then makes two recursive calls to compute the two smaller powers and multiplies them. The base case is n=1. Your code should be efficient enough to avoid making redundant function calls. For example, to compute 39, the function will call itself twice to compute 3 and 3. The function call that computes 3 will make a recursive call to compute 3 and then it will multiply the result by itself, while the function call that computes 3will make two recursive calls to compute 3 and 37, and so on until the base case is reached. Obviously, you are not allowed to use the pow library function in this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
