i know how to make a console read two integers but each integer by it self like this
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
if i entered two numbers, i.e (1 2), the value (1 2), cant be parse to integers
what i want is if i entered 1 2 then it will take it as two integers
One option would be to accept a single line of input as a string and then process it.
For example:
One issue with this approach is that it will fail (by throwing an
IndexOutOfRangeException/FormatException) if the user does not enter the text in the expected format. If this is possible, you will have to validate the input.For example, with regular expressions:
Alternatively:
int.TryParseto attempt to parse the strings into numbers.