pixelcat, string[] arr = Console.ReadLine().Split(' '); int[] arr2 = new int[arr.Length]; for(int i = 0; i < arr.Length; i++) { arr2[i] = Convert.ToInt32(arr[i]); } C# string[] arr = Console.ReadLine().Split(' '); int[] arr2 = new int[arr.Length]; for(int i = 0; i < arr.Length; i++) { arr2[i] = Convert.ToInt32(arr[i]); }
pixelcat, Например, как-нибудь так: using System; namespace CSharp_Shell { class Program { public static void Main() { double [] x = new double [10]; double s = 0; for (;;) { Console.Write("» "); var line = Console.ReadLine().Split(" "); for (int i = 0; i < 10; i++) { x = double.Parse(line); s += x; } Console.WriteLine(s / 10); } } } } Дальше вводим десять чисел одной строчкой в строку line, потом в цикле эту строку распарсиваем в элементы массива и получаем после окончания цикла на экране их среднее арифметическое: » 1 2 3 4 5 6 7 8 9 10 5,5
Если актуально, то можно еще int.Parse(Example); Код int.Parse(Example); а тут даже результат в bool bool result = int.TryParse(input, out number); Код bool result = int.TryParse(input, out number);