Write a java program to repeatedly get two numbers from the user and display the sum of their squares. User numbers and result are real numbers. Repeat this interactive input/output until the first number exactly matches the sentinel value 990. Do not process the input matching the sentinel value. For each input use at most one prompting message on the same line the user will type their two numbers. For each set, place a message in front of the computer's answer which identifies it. The identifying message should end in an = sign (prefixed legend)
I think i got it right but is there a better way to write this because it just seems like it can be done better??????
mport java.util.*;
public class Main
{
public static void main(String[] args)
{double a,b,result;
Scanner in=new Scanner(System.in);
System.out.print("Enter 2 numbers(first is 990 to exit): ");
a=in.nextDouble();
while(a!=990)
{b=in.nextInt();
result=a*a+b*b;
System.out.println(a+"^2+"+b+"^2="+result);
System.out.print("Enter 2 numbers(first is 990 to exit): ");
a=in.nextDouble();
}
}
}