// // Loop3.java // // read two numbers and calculate x^y // until two neg. were read // import java.util.Scanner; public class Loop3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); double x, y, answer; // input System.out.print("Input two positives (neg. to quit): "); x = input.nextDouble(); y = input.nextDouble(); while(x>0 && y>0) { // process answer = Math.pow(x, y); System.out.println("Result: " + answer); // input System.out.print("Input two positives (neg. to quit): "); x = input.nextDouble(); y = input.nextDouble(); } } }