jae-l
6/1/2017 - 12:38 AM

Example of how to read an array from the console and print it.

Example of how to read an array from the console and print it.

int elements = int.Parse(Console.ReadLine());
int[] numbers = new int[elements];

for (int i = 0; i < elements; i++)
{
  numbers[i] = int.Parse(Console.ReadLine());
}

for (int i = 0; i < numbers.Length; i++)
{
  Console.Write(numbers[i] + " ");
}

//  5
//  55
//  69
//  4
//  1
//  21
//  55 69 4 1 21