Read multiple lines from console to arrays
Hey! The input is - n - number of pairs, and n lines after - with pairs of numbers, the code will be below. F.ex. with input : 3 1 2 3 4 5 6 Output will be: 1 2 0 1 2 1 1 2 2 I can't understand why "Pasrse" takes only the input of the line with (1 2) and saves it to all array elements. Or it's the way how indexes [0] and [1] in "Parse" work? Will be grateful for the explaination. static void Main(string[] args) { int i, n = int.Parse(Console.ReadLine()); string[] tokens = Console.ReadLine().Split(' '); int[] arr1 = new int[n]; int[] arr2 = new int[n]; while (Console.ReadLine() != "") { for (i = 0; i < n; i++) { arr1[i] = int.Parse(tokens[0]); arr2[i] = int.Parse(tokens[1]); } } for (i = 0; i < n; i++) { Console.WriteLine(arr1[i] + " " + arr2[i] + " " + i); }