👤

Answer :

Answer:

public static int powerTwo(int n) {

  if (n == 0){

     return 1;

  } else {

     return 2 * powerTwo(n-1);

  }

}

Explanation:

There are actually three mistakes:

  • 2⁰ = 1, so the end criterium of the recursion should be n==0
  • the + should be a *
  • various curly braces missing

Go Teaching: Other Questions