Question: 3 0 . 5 . 1 : Write a recursive method to compute a power of two. 5 9 7 7 1 4 . 2
: Write a recursive method to compute a power of two.
qxzqy
In order to compute a power of two, you can take the nextlower power and double it For example, if you want to compute and you know that then Write a recursive method
public static int powint n
where n is the exponent, that is based on this observation. If the exponent is negative, return
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
