Recursive Power Method Call
What is the output of power(2, 3) based on the above method?
public int power(int base, int exp) {
if(exp == 0) {
return 1;
}
return base * power(base, exp - 1);
}
A
error
B
8
C
6
D
9
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE