We need to use the Console.ReadLine() to Read something or Get Input in C# Console
Application and need to use Console.WriteLine() or Console.Write() in order to Write something or print Output in C# Console Application
The difference between WriteLine() and Write() :
- WriteLine() prints the string and the cursor moves to the next line after printing the string.
- Write() prints the string and the cursor stays at the end of the printed string.
Simple C# Program:
using System; //Namespace Declaration
class MyFirstClass //Class Declaration
{
Public static void Main() // Main method
{
Console.WriteLine("Hello World"); //Prints message
}
}
OUTPUT: