• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
5 views

Problem:

Write an expression that executes the loop body as long as the user enters a non-negative number.

by (3.5k points)  
edited by

1 Answer

0 votes

Solution:

import java.util.Scanner;
public class LoopExample
     public static void main (String [] args)
    
          Scanner scnr = new Scanner(System.in);
      
          int egNum= 11;
         
          while (egNum>=0)
         
              System.out.println(Body);
             
              egNum= scnr.nextInt();
         
          System.out.println(Done.);
          return;
by (1.6k points)  
...