id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

Recursion-1 > powerN
prev  |  next  |  chance

Given base and n that are both 1 or more, compute recursively (no loops) the value of base to the n power, so powerN(3, 2) is 9 (3 squared).


powerN(3, 1) → 3
powerN(3, 2) → 9
powerN(3, 3) → 27

...Save, Compile, Run (ctrl-enter)

public int powerN(int base, int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 327.0

Copyright Nick Parlante 2017 - privacy