Complete the code to print numbers from 0 to 4 using a for loop.
for (int i = 0; i [1] 5; i++) { Console.WriteLine(i); }
The for loop runs while i is less than 5, so it prints 0 to 4.
Complete the code to sum numbers from 1 to 5 using a for loop.
int sum = 0; for (int num = 1; num [1] 5; num++) { sum += num; } Console.WriteLine(sum);
The loop includes 5 by using <=, so sum is 1+2+3+4+5 = 15.
Fix the error in the for loop condition to count down from 5 to 1.
for (int i = 5; i [1] 1; i--) { Console.WriteLine(i); }
The loop runs while i is greater than or equal to 1, counting down.
Fill both blanks to create a for loop that prints even numbers from 2 to 10.
for (int i = [1]; i [2] 10; i += 2) { Console.WriteLine(i); }
The loop starts at 2 and runs while i is less than or equal to 10, printing even numbers.
Fill all three blanks to create a for loop that prints the squares of numbers from 1 to 5.
for (int [1] = 1; [2] [3] 5; [1]++) { Console.WriteLine([1] * [1]); }
The loop variable i starts at 1 and runs while it is less than or equal to 5, printing squares.
