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 run while i is less than or equal to 5 to print numbers 1 through 5.
Complete the code to sum numbers from 1 to 10 using a while loop.
int sum = 0; int num = 1; while(num [1] 10) { sum += num; num++; } System.out.println(sum);
The loop should continue while num is less than or equal to 10 to include 10 in the sum.
Fix the error in the for loop condition to avoid an infinite loop.
for(int i = 0; i [1] 5; i++) { System.out.println(i); }
The loop should increment i and run while i is less than 5 to avoid infinite loop.
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 runs while i is less than or equal to 10 to print even numbers up to 10.
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, runs while i is greater than or equal to 1, and decrements i by 1 each time.