In this tutorial, we will discuss the concept of C# Hello world program
In this topic, we are going to learn how to write a simple Hollow world program in C#
The word “Hello world” cannot be forgotten by programmers as it is the first program learnt by programmers in every programming language.
“Hello world” program is very easy to learn and understand and the purpose of this program is to get us familiar with the basic requirements and syntax of this program in C# programming language
This program returns the simple output “Hello world” and is used to introduce programming languages to beginners.
Before you write a code in hello world program, you must ready your system for code writing, compilation and running.
Program 1
//Hollo world program in C# using System; public class HelloWorld //class name { public static void Main(string[] args)//main method { System.Console.WriteLine ("Hello World"); } }
When the above code is executed, it produces the following result
Hello World
Program 2
//Hello world program using System; namespace HelloWorld { class Hello { static void Main(string[] args) { String message="Hello World!"; System.Console.WriteLine(message); } } }
When the above code is executed, it produces the following result
Hello World!
A basic C# program consist the following parts
Explanation of the program
//Hello world program
// symbol indicates the beginning of the comment in the C# program likes other program. comments (Commented lines) are not executes by the C# compiler(it is ignored by the compiler), they are used to programmers or developers to better understand the code
Namespace HelloWorld{…} – Here, The namespace is the keyword which is used to define our own Name space. in this program,we create a user defined namespace called HolloWorld
class Hello{…} – class is a object oriented programming technique and above statement use to create a class name – Hello
static void Main(string[] args){…} – The above statement is a main method of the class Hello. and the execution of every C# program start from the main() method. the pre-defined main methods is compulsory of the every C# program(object oriented programming technique)
System.Console.WriteLine (“Hello World”). – This is the piece of code used to prints Hello world in the screen. This is the output of the program
Important points of the C# program
Similar post
Hello world program in C language
Hello world program in C++ language
How to find reverse number using method In this article, we will discuss the concept…
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…