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
5.9k 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
5.4k points