Interacting with the User
To make programs interactive, we need to take input from the user.
Using Console.ReadLine()
This method reads a line of text as a string.
csharp Console.WriteLine("Enter your name:"); string userName = Console.ReadLine(); Console.WriteLine("Hello " + userName);
Important: Type Conversion
Since ReadLine() returns a string, you must convert it if you want numbers:
csharp
Console.WriteLine("Enter age:");
int age = Convert.ToInt32(Console.ReadLine());