Answer to Question 15-3

No, it does not work. Suppose k = 2. Since power(3.0, 2) finds that k is even, it selects the second case. It computes power(3.0, 1), which returns 3.0. Then it calls power(3.0, 2) to do the squaring. So power(3.0, 2) calls power(3.0, 2). It can never stop. We say that it is an infinite recursion.