Complete the code to initialize the loop variable correctly.
for ([1]; i < 5; i++) { System.out.println(i); }
The loop variable must be declared and initialized as int i = 0 inside the for loop.
Complete the code to write the correct loop condition.
for (int i = 0; [1]; i++) { System.out.println(i); }
The loop should run while i is less than 5, so the condition is i < 5.
Fix the error in the loop update expression.
for (int i = 0; i < 5; [1]) { System.out.println(i); }
i-- causes an infinite loop.i += 2 skips numbers.The update expression i++ increases i by 1 each loop, which is the standard increment.
Fill both blanks to create a loop that counts down from 10 to 1.
for (int i = [1]; i [2] 0; i--) { System.out.println(i); }
i < 0 as condition causes no iterations.The loop starts at 10 and runs while i > 0, printing numbers from 10 down to 1.
Fill all three blanks to create a loop that prints even numbers from 2 to 10.
for (int [1] = [2]; [1] [3] 10; [1] += 2) { System.out.println([1]); }
< instead of <= causes missing 10.The loop variable is i, starting at 2, running while i <= 10, and increasing by 2 each time to print even numbers.
