C# program for addition of two numbers using a static method
Program.cs
static int addition(int a, int b)
{
    int sum = a + b;
    return sum;
}
Console.Write("Addition: " + addition(10, 20));
Output
kodingwindow@kw:~/csharp$ dotnet run
Addition: 30
kodingwindow@kw:~/csharp$ 
Advertisement