Complete the code to print numbers from 0 to 4.
for [1] := 0; i < 5; i++ { fmt.Println(i) }
The variable i is commonly used as the loop counter in Go for loops.
Complete the code to sum numbers from 1 to 5.
sum := 0 for i := 1; i <= [1]; i++ { sum += i } fmt.Println(sum)
The loop should run until i is less than or equal to 5 to include 5 in the sum.
Fix the error in the loop condition to print even numbers from 0 to 8.
for i := 0; i [1] 10; i += 2 { fmt.Println(i) }
The loop should continue while i is less than 10 to print numbers up to 8.
Fill both blanks to create a loop that prints numbers from 5 down to 1.
for i := [1]; i [2] 0; i-- { fmt.Println(i) }
The loop starts at 5 and continues while i is greater than 0, decreasing by 1 each time.
Fill all three blanks to create a loop that prints squares of numbers from 1 to 3.
for [1] := 1; [2] <= 3; [3]++ { fmt.Println(i * i) }
The loop variable i is used consistently in initialization, condition, and increment.
