Home > Courses > C# Programming Course > C# Program to display or output a message

C# Program to display or output a message

Subject: C# Programming Course
Every programming journey starts with displaying simple message on the screen.

We would be using the Visual Studio IDE for rapid and easy development. Download Visual Studio (Community Edition-It is free) here https://visualstudio.microsoft.com/downloads/) and install it.

See screenshot 1 to 5 on how to create a Console Application.

Note: a C# console application is a simple program that runs in a command-line interface (CLI) or terminal window, without a graphical user interface (GUI). It is one of the most basic and commonly used project types in C#, often used for learning, small utilities, or backend processes.

For now we would be learning C# using the Console Application, later on we would learn how to build web application (ASP.NET Core) using C#.

After the installation create the Console application (see the screenshot) and write the program to display an "Hello TEA Learn"

Program.cs

using System;
class Program
{
    private static void Main(string[] args)
    {
        Console.WriteLine("Hello TEA Learn");
    }
}


using System; imports the namespace containing basic classes like Console.
class Program defines a class named Program.
static void Main() is the entry point of the program.
Console.WriteLine outputs text to the console.

Start VisualStudio, Create New Project, Choose "Console App" and click "Next" button




You can leave the default name for the app "ConsoleApp1" or change it as you want and click "Next" button




Click "Next" button again




Then code the program and save it as "Program.cs"




After clicking the run icon (green play button) - in the previous screenshot. The program would run and you will see the output as shown here





By: Benjamin Onuorah

Comments

No Comment yet!

Login to comment or ask question on this topic




  • 1 C# Program to display or output a message