Page 1 of 1

Lab Exercise Modify the following program with do-while loop to allow the user continuously input number1 and number2 un

Posted: Sat May 14, 2022 6:39 pm
by answerhappygod
Lab Exercise Modify The Following Program With Do While Loop To Allow The User Continuously Input Number1 And Number2 Un 1
Lab Exercise Modify The Following Program With Do While Loop To Allow The User Continuously Input Number1 And Number2 Un 1 (35.44 KiB) Viewed 48 times
Lab Exercise Modify the following program with do-while loop to allow the user continuously input number1 and number2 until the input number2 is not 0. import java.util.Scanner; class QuotientWithExcpetion { public static void main(String[] args) { Scanner input = new Scanner(System.in); // Prompt the user to enter two Integers System.out.print("Enter two integers: "); int number1= input.nextInt(); int number2 = input.nextInt(); I try block try! System.out.println(number1 + "/" + number2 + "Is + (number1 / number2)) 1 Il catch block catch (ArithmeticException e) { System.out.println("Exception caught: Division by zero."): System.out.println("Finish"); ha