Problem 9
(Recursive power Method) Write a recursive method power(base, exponent) that, when called, returns base exponent For example, power \((3,4)=3^{*} 3^{*} 3^{*} 3 .\) Assume that exponent is an integer greater than or equal to 1\. Hint: The recursion step should use the relationship base exponent \(=\) base \(\cdot\) base exponent- 1 and the terminating condition occurs when exponent is equal to 1 , because base \(^{l}=\) base Incorporate this method into a program that enables the user to enter the base and exponent.
Problem 11
(Greatest Common Divisor) The greatest common divisor of integers \(x\) and \(y\) is the largest integer that evenly divides into both \(x\) and \(y .\) Write a recursive method gcd that returns the greatest common divisor of \(x\) and \(y .\) The gcd of \(x\) and \(y\) is defined recursively as follows: If \(y\) is equal to 0 then \(\operatorname{gcd}(x, y)\) is \(x ;\) otherwise, \(\operatorname{gcd}(x, y)\) is \(\operatorname{gcd}(y, x \% y),\) where \(\%\) is the remainder operator. Use this method to replace the one you wrote in the application of Exercise 6.27