Question: Write an expression that executes the loop while the user enters a number greater than or equal to 0 . Note: These activities may test

Write an expression that executes the loop while the user enters a number greater than or equal to 0.
Note: These activities may test code with different test values. This activity will perform three tests, with user input of 9,5,2,-1, then with user input of 0,-17, then with user input of 010-1. See "How to Use zyBooks".
Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "Test aborted."
Learn how our autograder works
543758-3968738.9329y,
public class NonNegativeLooper {
public static void main (String [] args){
Scanner scnr = new Scanner(
System.in);
int userNum;
userNum = scnr. nextInt () ;
while C** Your solution goes here *D {
System.out.println("Body");
}
userNum = scnr. nextInt ();
System.out.println("Done.");
}
}
 Write an expression that executes the loop while the user enters

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!