185k views
12 votes
Which XXX will prompt the user to enter a value greater than 10, until a value that is greater than 10 is actually input?

do {
System.out.println("Enter a number greater than 10:");
userInput = scnr.nextInt();
} while XXX;

a. (!(userInput < 10))
b. (userInput < 10)
c. (userInput > 10)
d. (!(userInput > 10))

1 Answer

9 votes

Answer:

b. (userInput < 10)

Step-by-step explanation:

The piece of code that will accomplish this would be (userInput < 10). The code will first ask the user to "Enter a number greater than 10:" then it will compare the value of userInput to 10, if it is less than 10 it will redo the loop over and over again until the userInput is greater than 10. Once the userInput is greater than 10 it will break out of the do-while loop and continue whatever code is written under and outside the do-while loop

User Shobhit Verma
by
5.4k points