59.2k views
0 votes
In the following code, what values could be read into number to terminate the while loop? Scanner keyboard = new Scanner(System.in); System.out.print("Enter a number: "); int number = keyboard.nextInt(); while (number < 100 || number > 500) { System.out.print("Enter another number: "); number = keyboard.nextInt(); }

User Xyzzz
by
9.0k points

1 Answer

5 votes

Answer:

The following code read the numbers in the range of 100 through 500.

Step-by-step explanation:

The following code is written in Java Programming Language.

Here, firstly create a new Scanner object "keyboard" then, declare an integer variable "number" to "keyboard.nextInt()" and the set the loop while and inside it print the message.

User Kevin Hussey
by
8.8k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.