Task 3 of 10 · 0 solved · 10 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

5.5 Recursion — powers of two

Total: 0 / 3 pts
Practice mode — check each part and get hints as you go.
Task

Fill in powerOfTwo so that it returns 2 raised to the power n, recursively — the method must call itself.

Base case: powerOfTwo(0) is 1. The program prints 1 and then 32.

Your solution