Friday, 29 August 2014

Addition of two numbers in C sharp

using System;
class Program
{
    static void Main()
    {
        // addition of two numbers
        int a, b, sum;
        Console.WriteLine("Enter the value of a:");
        a = int.Parse(Console.ReadLine());
        Console.WriteLine("Enter the value of b:");
        b = int.Parse(Console.ReadLine());
        sum = a + b;
        Console.WriteLine("The sum of {0} & {1} is {2}",a,b, sum);
        Console.ReadLine();
    }
}

Addition of two numbers in C sharp
Output

No comments:

Post a Comment