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

Brandon Holmes
Brandon Holmes
124 Points

Why is this not working?

Is this not what it is asking for?

CodeChallenge.cs
namespace System
{
  class Program
  {
      static void Main()
      {
          Console.Write("Enter your name:");

          string firstName = Console.ReadLine();

          Console.WriteLine("Hello" + firstName + "have a good day!);

      }
  }
}

2 Answers

Jon Wood
Jon Wood
9,884 Points

I think I see. In this line: Console.WriteLine("Hello" + firstName + "have a good day!); You have to put an ending " after the exclamation point to denote the end of the string.

Steven Parker
Steven Parker
231,210 Points

It doesn't look like you read the instructions.

This challenge doesn't require you to build a program with a "Main" function, it only needs a few lines of code. Also, the output strings the challenge asks for are quite different from what you have here.

Jon's point about closing the final string is valid, but the other issues will need to be addressed to pass the challenge.