package recursion1;

/*
 * 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
 */

public class PowerNTest {
    public static void main(String[] args) {
		
        PowerNTest test = new PowerNTest();
        System.out.println(test.powerN(3, 1));
        System.out.println(test.powerN(3, 2));
        System.out.println(test.powerN(3, 3));
	}
    
    public int powerN(int base, int n) {
        if (n == 1) {
            return base;
        } else {
            return base * powerN(base, n - 1);
        }
    }
}
@@ -184,16 +184,17 @@
 N(3, 1) 
+-
 -%3E 3%0A * 
@@ -206,16 +206,17 @@
 N(3, 2) 
+-
 -%3E 9%0A * 
@@ -228,16 +228,17 @@
 N(3, 3) 
+-
 -%3E 27%0A *
@@ -676,8 +676,9 @@
 %0A    %7D%0A%7D
+%0A

Update PowerNTest.java