C#C
C#3y ago
smiley303

✅ Array Problem - the variable "i" here appears to never change?

int[] numbers = new int[5];

for (int i = 0;i < numbers.Length; i++)
{
    Console.WriteLine($"Please enter a number to fill index: {numbers[i]}");
    int userInput = Convert.ToInt32(Console.ReadLine());
    numbers[i] = userInput;
}

I have a feeling it is this part "{numbers[i]}" but i don't understand why, the output is in image attached and also it stops after it accepts 5 variable which makes me think i is being incremented.
image.png
Was this page helpful?