How to write "Hello World" in C#?



To print “Hello World” in C#, use the Console.WriteLine.

Let us see a basic C# program to display a text −

Example

 Live Demo

using System;
using System.Collections.Generic;
using System.Text;

namespace Program {
   class MyApplication {
      static void Main(string[] args) {
         Console.WriteLine("Hello World");
         Console.Read();
      }
   }
}

Output

Hello World

Above, we displayed the text “Hello World” using the WriteLine() method. The output is displayed using the Console −

Console.WriteLine("Hello World");
karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know


Advertisements