C# program to print a new line

Printing a new line in C#: Here, we are going to learn how to print a new line in C# after the message, between the message and anywhere else? By IncludeHelp Last updated : April 15, 2023

C# printing a new line

To print a new line within the message while printing it on the console, we can use following methods,

  • Using \n – prints new line
  • Using \x0A or \xA (ASCII literal of \n) – prints new line
  • Console.WriteLine() – prints new line, if we write any message in the method – it will print new line after the message, if we do not write any message – it will print a new line only.

C# code to print new line

In the below example – we are printing new lines between the messages or/and after the message.

// C# program to print a new line

using System;
using System.IO;
using System.Text;

namespace IncludeHelp {
  class Test {
    // Main Method 
    static void Main(string[] args) {
      //using \n
      //using \x0A

      Console.WriteLine("end of the program");

      //hit ENTER to exit the program



end of the program

C# Basic Programs »

Related Programs

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.