Question: For each of the following while loops, state how many times the loop will execute its body. Remember that zero, infinity, and unknown are legal

For each of the following while loops, state how many times the loop will execute its body. Remember that “zero,” “infinity,” and “unknown” are legal answers. Also, what is the output of the code in each case?

a.

int x = 1; while (x < 100) { System.out.print (x +

b.

int x = 1; while (x < 100) { System.out.print (x +

c.

"); x += 10;

d.

e.

f.

int x = 1; while (x < 100) { System.out.print (x + "); x += 10;

Step by Step Solution

3.38 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Executes body 10 times Output is 1 11 21 31 41 51 61 ... View full answer

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 Building Java Programs A Back to Basics Approach Questions!