Problem Statement:
Given base and n that are both 1 or more, compute the value of base to the n power, so powerN(3, 2)
is 9 (3 squared).
Example
powerN(3, 1) → 3
powerN(3, 2) → 9
powerN(3, 3) → 27
The function signature is public int powerN(int base, int n)
I'm finding it to difficult to solve this? Help me out.
EDIT: I need a solution which does not uses built in mathematical formulas and recursion