I want to write a Program which reads the user inputs in the same line. Such as
if we write
int x, y, z;
x = Console.ReadLine();
y = Console.ReadLine();
z = Console.ReadLine();
when the user inputs the value of x
and then press enter it creats a new line to read the value for y
. Same happens when it's time for z. But I want it to do like this :
When the user inputs a value for x
and press Enter then it remains in the same line for reading another input which is the value for y
and then in the same line for reading z
eg: If user inputs 4 for x, 5 for y and 6 for z
THE CODE OUTPUT SHOWS LIKE THIS FOR 3 DIFFERENT INTEGERS:
4
5
6
BUT I WANT IT TO BE LIKE THIS:
4 5 6
Note that I can easily read multiple values when Enter pressed once on the line as there plenty existing answers like Read numbers from the console given in a single line, separated by a space basically all doing String.Split
, but it is different from what I want.