1.2 – Addition

Question


Write a program which accept two numbers and print their sum.

Solution


class Addition
    {
        static void Main(string[] args)
        {
            int a, b, c;                               //initialization
            Console.Write(“Enter first number : “);
            a = Convert.ToInt16(Console.ReadLine());
            Console.Write(“Enter second number : “);
            b = Convert.ToInt16(Console.ReadLine());
            c = a + b;                                //calculation
            Console.WriteLine(“Addition = “ +c);
        }
    }

 Previous                                                Home                                                   Next


Output

Addition