Module: VARIABLES. OUTPUT FORMATS


Problem

3/5

Entering Variable Values

Theory Click to read/hide

Enter statement
In order for the user to be able to set the value of the variable himself, it is necessary to be able to enter values ​​from the keyboard. 
C# has two value input operators: Console.Read(); and Console.ReadLine();
 
Read reads only one character from the entered values, or -1 if there are no more characters left to read. Moreover, the method returns an integer character code, so to get a character variable, you need to perform a conversion using the Convert.ToChar().
 
int x = Console.Read(); // read character code
char a = Convert.ToChar(x); // converting the received code into the value of a character variable
 
With ReadLine() , you can read a string sequence before entering a new line. As a result, the method may return a string or null if there are no more strings.

For example, the entry reads the line:
stringline = Console.ReadLine();

To read an integer value, you need to read the string and convert it to a number:
 
int a = int.Parse(Console.ReadLine());
 
If the numbers go in a line, then you need to count the line, & nbsp; and get an array of strings from it using the space character as a separator. And then each element of the array is converted to a number:
string[] numbers = Console.ReadLine().Split(' ');
int a = int Parse(numbers[0]);
int b = int.Parse(numbers[1]);

Problem

Rabbit Clover began to study the input operator so that his programs would become more universal and work on different sets of values.
He wants to enter the values ​​of 4 variables from the keyboard and display them on the screen to make sure they are in the right variables. But he made some mistakes in the program.
Help him fix them.

1. In the seventh and eighth lines, correct the errors when writing the input statements so that the values ​​of the variables indicated on the line are entered.
2. On the 9th, 10th, and 11th line, add the necessary code yourself to obtain the desired values.
3. In the 12th line, write the operator for displaying the values ​​of all variables on the screen in alphabetical order, separated by a space