Basic Programming C# Examples

C# Program to print Hello and your name in a separate line

The Program in C# Program to print Hello and your name in a separate line are given below:

using System;

namespace HelloName
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Everybody, How is it going ,huh!");
            Console.WriteLine("To Codeauri Family");
        }
    }
}

Output:

Hello Everybody, How is it going ,huh!
To Codeauri Family

Pro-Tips💡

Here’s a step-by-step explanation of the above code:

  1. using System;: This line imports the System namespace, which contains many useful classes, including the Console class that we will use to interact with the console.
  2. namespace HelloName: This line declares a new namespace called HelloName. A namespace is used to organize code and prevent naming collisions with other code in different namespaces.
  3. class Program: This line declares a new class called Program. The Main method will be defined inside this class.
  4. static void Main(string[] args): This line declares the Main method, which is the entry point for the program. The Main method is static, meaning it can be called without creating an instance of the class. The void return type means that the Main method doesn’t return a value. The string[] args parameter is an array of strings that can be passed as command-line arguments to the program.
  5. Console.WriteLine("Hello");: This line writes the string “Hello” to the console using the WriteLine method of the Console class. The WriteLine method writes the text to the console and appends a newline character to the end.
  6. Console.WriteLine("Your name");: This line writes the string “Your name” to the console in a separate line, just like in step 5.

Learn C-Sharp ↗

C-sharp covers every topic to learn about C-Sharp thoroughly.

Learn C Programming ↗

C-Programming covers every topic to learn about C-Sharp thoroughly.

Learn C++ Programming↗

C++ covers every topic to learn about C-Sharp thoroughly.

Codeauri is Code Learning Hub and Community for every Coder to learn Coding by navigating Structurally from Basic Programming to Front-End Development, Back-End Development to Database, and many more.

Related Posts

Programming Languages( Types, Pros and Cons)-Codeauri

What are the types or levels of Programming Languages? The types or levels of programming languages are divided into two types: Types Of Programming Languages: 1.Machine-level Language :1st…

C# Program to Find Sum of Rows & Columns of a Matrix

The Program in C# Program to Find Sum of Rows & Columns of a Matrix is given below: Output: Hello Codeauri Family,enter the number of rows and columns…

C# Program to Calculate Determinant of Given Matrix

The Program in C# Program to Calculate Determinant of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns of the matrix…

C# Program to Find Sum of right Diagonals of a Matrix

The Program in C# Program to Find Sum of right Diagonals of a Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns…

C# Program to Find Transpose of Given Matrix

The Program in C# Program to Find Transpose of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns in the matrix:22Enter…

C# Program for Multiplication of two square Matrices

The Program in C# Program for Multiplication of two square Matrices is given below: Output: Hello Codeauri Family, enter the number of rows/columns in the matrices:2Enter the elements…

Leave a Reply

Your email address will not be published. Required fields are marked *

Your Journey into Code Begins Now: Discover the Wonders of Basic Programming

X