// Compute the n-th power of some number, m. import java.util.Scanner; class MyPower { public static void main (String[] args) { Scanner scan = new Scanner(System.in); System.out.println(); System.out.print ("Enter the number: "); System.out.flush(); int m = scan.nextInt(); System.out.print ("Enter the power: "); System.out.flush(); int n = scan.nextInt(); int result = compute (m, n); System.out.println ("The power " + n + " of " + m + " is " + result); } private static int compute (int m, int n) { if (n == 0) return 1; else return m * compute (m , n-1); } }