Complete the code to print numbers from 1 to 5 using a for loop.
for(int i = 1; i [1] 5; i++) { printf("%d\n", 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 sum numbers from 1 to 10 using a while loop.
int sum = 0; int i = 1; while(i [1] 10) { sum += i; i++; }
The loop should run while i is less than or equal to 10 to include 10 in the sum.
Fix the error in the for loop condition to print even numbers from 2 to 10.
for(int num = 2; num [1] 10; num += 2) { printf("%d\n", num); }
The loop should continue while num is less than or equal to 10 to include 10.
Fill both blanks to create a for loop that prints numbers from 10 down to 1.
for(int i = [1]; i [2] 1; i--) { printf("%d\n", i); }
The loop starts at 10 and continues while i is greater than or equal to 1, decreasing by 1 each time.
Fill all three blanks to create a for loop that prints squares of numbers from 1 to 5.
for(int [1] = 1; [2] [3] 5; [1]++) { printf("%d\n", [1] * [1]); }
The loop variable is i. It starts at 1 and runs while i is less than or equal to 5.