1. Revise the following code so that it uses a while loop instead of a dowhile loop: Scanner keyboard = new Scanner(System.in); int number; do { System.out.println("Enter a whole number:"); number =...


1. Revise the following code so that it uses a while loop instead of a dowhile


loop:


Scanner keyboard = new Scanner(System.in);


int number;


do


{


System.out.println("Enter a whole number:");


number = keyboard.nextInt();


System.out.println("You entered " + number);


} while (number > 0);


System.out.println("number after loop = " + number);


2. What output is produced by the following code?


int count = 0;


while (count


{


System.out.println(count);


count;


}


System.out.println("count after loop = " + count);



Nov 17, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here