About C# Programming Language

Overview

C# is a multi-paradigm programming language developed by Microsoft. It is widely used for building Windows applications, web applications, and games using the .NET framework.

Example: Hello World

Here's a basic "Hello, World!" program in C#:

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, World!");
    }
}

Variables and Operations

C# supports variables and operations similarly to other languages:

using System;

class Program
{
    static void Main()
    {
        int a = 10;
        int b = 5;
        int sum = a + b;
        int product = a * b;

        Console.WriteLine($"Sum: {sum}");
        Console.WriteLine($"Product: {product}");
    }
}

Conditional Statements

Using conditional statements in C#:

using System;

class Program
{
    static void Main()
    {
        int number = 10;

        if (number > 0)
        {
            Console.WriteLine("The number is positive.");
        }
        else
        {
            Console.WriteLine("The number is not positive.");
        }
    }
}

Loops

Example of a loop in C#:

using System;

class Program
{
    static void Main()
    {
        for (int i = 1; i <= 5; i++)
        {
            Console.WriteLine($"Number: {i}");
        }
    }
}