Write a code fragment that reads and prints integer values entered by a user until a particular sentinel value (stored in SENTINEL) is entered. Do not print the sentinel value.

What will be an ideal response?


```
Scanner scan = new Scanner(System.in);
System.out.print("Enter some integers (" + SENTINEL +
" to quit): ");
number = scan.nextInt();
while (number != SENTINEL)
{
System.out.println(number);
number = scan.nextInt();
}

```

Computer Science & Information Technology

You might also like to view...

Expand the acronym LAN.

What will be an ideal response?

Computer Science & Information Technology

Ken Thompson and Dennis Ritchie designed the high-level language ¬¬________ specifically to implement the UNIX operating system.

a) Java b) C c) Visual Basic d) C++

Computer Science & Information Technology

If a comment does not close when an empty cell is clicked, the ________ /Hide Comments feature might be turned on

Fill in the blank(s) with correct word

Computer Science & Information Technology

When the MessageBox action is executed, the macro is paused so a message can be displayed. Click ________ in order for the macro to continue

A) OK B) Cancel C) Go D) Continue

Computer Science & Information Technology