Complete the code to print numbers from 1 to 5 using a loop.
for (int i = 1; i [1] 5; i++) { Console.WriteLine(i); }
The loop should run while i is less than or equal to 5 to print numbers 1 to 5.
Complete the code to sum numbers from 1 to 10 using a loop.
int sum = 0; for (int num = 1; num [1] 10; num++) { sum += num; } Console.WriteLine(sum);
The loop should include 10, so use <= to sum numbers 1 through 10.
Fix the error in the loop condition to print all elements of the array.
string[] fruits = {"apple", "banana", "cherry"};
for (int i = 0; i [1] fruits.Length; i++)
{
Console.WriteLine(fruits[i]);
}Array indexes go from 0 to Length - 1, so the loop should run while i < fruits.Length.
Fill both blanks to create a loop that prints even numbers from 2 to 10.
for (int num = [1]; num [2] 10; num += 2) { Console.WriteLine(num); }
The loop starts at 2 and runs while num <= 10 to include 10.
Fill all three blanks to create a loop that prints numbers from 5 down to 1.
for (int i = [1]; i [2] 1; i [3]) { Console.WriteLine(i); }
i and cause an infinite loop.The loop starts at 5, runs while i >= 1, and decreases i by 1 each time.
