← C# from Scratch Lesson 2 of 39 · 10 XP

Output

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

  • Console.WriteLine(x) — prints and moves to a new line;
  • Console.Write(x) — prints without a line break.
Console.Write("Level ");
Console.Write(3);
Console.WriteLine("!");     // Level 3!
Console.WriteLine(2 + 3);   // 5 — the expression is evaluated first
Console.WriteLine("2 + 3"); // 2 + 3 — and this is just text

Inside a string, \n is a line break, \t is a tab, \" is a quote, and \\ is a backslash.

Task. Print exactly three lines:

IGD Games
Score: 5
"Game over"

Get the number 5 with the expression 2 + 3, and build the second line from Console.Write and Console.WriteLine.

Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.