Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

you use what you have learned about while loops. Study the following code, and t

ID: 3719250 • Letter: Y

Question

you use what you have learned about while loops. Study the following code, and then answer the Questions 1-4.

int counter = 8;

while (counter < 8) {

          System.out.print ("value of counter is: " + counter);

          counter++;

}

Answer the following questions.

1- What is the control variable? ____________

2. Waht is the output? ____________

3. What is the output if counter =8 changed to counter = 4? ____________________

4. What is the output if the code is changed to while (counter <= 8) ______________

Explanation / Answer

1-
control variable is counter as it determies how many iterations will happen in while loop

2.
There will be no output as program flow will not enter while loop

3.
value of counter is: 4
value of counter is: 5
value of counter is: 6
value of counter is: 7

4.
value of counter is: 8