Console Output
In C#,
Console.Write and Console.WriteLine are used to output information to the console.Console.Write
The
Console.Write method outputs the specified message to the console without moving to a new line. This allows you to continue output on the same line. Line 1, Char 1
Console.WriteLine
The
Console.WriteLine method outputs the specified message to the console and automatically adds a line break after the output. This is convenient for sequentially printing information on separate lines. Line 1, Char 1
Exercises
- Print your first and last name on separate lines.
Line 1, Char 1
- Print your first and last name on one line, and your hobbies on separate lines.
Line 1, Char 1