Please help me with the task:C# Beginner2 Victory is close Introduction to arrays in C# Fill the array

Hello, I’m working on this task:

Read an integer count from the console. Then create an array of integers of size count. The value of every cell should be its index value. Output every cell of the array to the screen, each from the new line, starting from the cell with index 0. For example:
>4
0
1
2
3

Here is my code:


namespace Arrays
{
   class FillArray
   {
       public static void Main(string[] args)
       {
           int count = int.Parse(Console.ReadLine());
           int[] array = new int[count];

           for (int i = 0; i < count; ++i)
           {
               count[i] = i;
               Console.WriteLine(count[i]);
           }
       }
   }
}

Can anyone please help me to solve it?

Знайшла помилку. Потрібно було не count а array підставити.

1 Like