Print Number in C#

Print Number in C#. In this program, we can print the number in the output screen. Using the namespace keyword, a scope can be declared. Making use of scopes within the project allows you to better organize your code, as well as create global-unique classes.

using System;

namespace Main
{
class Program
{
static void Main(string[] args)
{
int num = 100;
Console.WriteLine(num);
}
}
}

 

Output:

100

Uses of Namespace Keyword in C#

Using the namespace keyword, a scope can be declared. Making use of scopes within the project allows you to better organise your code, as well as creating global-unique classes. Sample Class is defined in two namespaces, one nesting inside the other, in the following example. Your application can be placed in a “named space” created by namespaces. As a result, the C# compiler can make sense of your program’s variable names and other identifiers.

Uses of Class in C#

A class is a blueprint or prototype that is defined by the user and from which objects are created. In essence, a class is a collection of fields and methods member functions that define actions. As the name suggests, property is a member that allows you to read, write, or compute the value of a private field with ease. In reality, properties are special methods called accessors that can be used as though they were public data members.