Complete the code to print numbers from 1 to 5 using a for loop.
for(int i = 1; i [1] 5; i++) { System.out.println(i); }
The loop should continue as long as i is less than or equal to 5 to print numbers 1 through 5.
Complete the code to stop the loop when the number 3 is reached.
for(int i = 1; i <= 5; i++) { if(i [1] 3) { break; } System.out.println(i); }
The loop should break when i equals 3, so the condition uses '=='.
Fix the error in the while loop condition to avoid an infinite loop.
int count = 0; while(count [1] 5) { System.out.println(count); count++; }
The loop should run while count is less than 5 to avoid infinite looping.
Fill both blanks to create a loop that prints even numbers from 2 to 10.
for(int i = [1]; i [2] 10; i += 2) { System.out.println(i); }
The loop starts at 2 and continues while i is less than or equal to 10 to print even numbers.
Fill all three blanks to create a loop that prints numbers from 10 down to 1.
for(int i = [1]; i [2] 1; i[3]) { System.out.println(i); }
The loop starts at 10, continues while i is greater than or equal to 1, and decreases i by 1 each time.