I have a task to read n given numbers in a single line, separated by a space ( ) from the console.
n
I know how to do it whe
You can use Linq to read the line then split and finally convert each item to integers:
int[] numbers = Console .ReadLine() .Split(new Char[] {' '}, StringSplitOptions.RemoveEmptyEntries) .Select(item => int.Parse(item)) .ToArray();