in java how do I write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with newline Ex: For the user input 123, 395, 25, the expected output is:

Respuesta :

Answer:

do{

             Scanner s1 = new Scanner( System.in);

              int a = s1.newInt();

             System.out.println(a);//println will automatically add a newline after each number input.

        }while(a<100);

And the program will terminate on first input itself as 123 is more than 100.

Explanation:

Please check the answer section.