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?
Submitted by IncludeHelp, on April 07, 2019

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 »


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.