Managing Console Input Output Operations in C#
The methods for reading from and writing to the console is provided by the System.Console class. This class gives us access to the standard input, standard output.
The console input stream object supports two methods for obtaining input from the keyboard.
1. Read(): It returns a single character as int.
int p=Console.Read(); Console.WriteLine((char)p);
2. ReadLine(): It returns a string containing a line of text.
string sk=Console.ReadLine(); Console.WriteLine(sk);
The console output stream supports two methods for writing to the console:
1. Write(): Outputs one or more values to the screen without a newline character.
2. WriteLine(): Outputs one or more values to the screen but adds a newline character at the end of the output.