Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics (Retired) Console I/O Formatting Output

How to use Console.WriteLine to print contents of the variables

string entry = "firstName"; Console.Write("what is your first name "); Console.ReadLine(); Console.WriteLine("Muhaned");

CodeChallenge.cs
string entry = "firstName";
Console.Write("what is your first name ");
Console.ReadLine();
Console.WriteLine("Muhaned");

1 Answer

Audrey Steed
Audrey Steed
1,112 Points

Here is my code for that:

string entry; 
Console.Write("What is your name?:"); 
entry = Console.ReadLine(); 
Console.WriteLine(entry); 

Console.WriteLine(); Prints text to the screen and makes the next text on a new line.

Console.Write(); Same as Console.WriteLine(); but the next text will be on the same line.

Console.ReadLine(); Gets input from the user and returns it in a string value.