Write a java program to repeatedly get two numbers from the user and display the
ID: 3623110 • Letter: W
Question
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)Explanation / Answer
please rate - thanks
import 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();
}
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.