C#

Reading an array of N elements

The first line contains N, the number of elements.

The next line contains N space-separated integers.

1
2
int N = Convert.ToInt32(Console.ReadLine());
int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);
comments powered by Disqus