Ask your own question, for FREE!
Computer Science 11 Online
OpenStudy (amy0799):

The following recursive method calculates 3^n:

OpenStudy (amy0799):

//precondition: n >=0 public int power3(int n) { if (n == 0) return 1; else { int p = power3(n/2); p^*=p; //multiple p by itself if (n%2 == 1) //if n is odd, p^*=3; //multiple p by 3 return p; } }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!