package recursion;

public class Power {

    static int power(int x, int n) {
        int result = 0;
        if (n == 0)
            result = 1;
        else
            result = x * power(x, n - 1);
        return result;
    }

    public static void main(String[] args) {
        int x = Integer.parseInt(args[0]);
        int n = Integer.parseInt(args[1]);
        int xn = powerc(x, n);
        System.out.println(xn);
    }
    
    
    
    

    static int powerc(int x, int n) {
        int result = 0;
        System.out.println("power(" + x + ", " + n + ")");
        if (n == 0)
            result = 1;
        else
            result = x * powerc(x, n - 1);
        System.out.println("power(" + x + ", " + n + ") = " + result);
        return result;
    }
}
