Addition of two numbers in C#

Simple program of adding two numbers in C# language by using Console method.

Source code - Addition of two numbers in Console(C#).

	
    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace additiontwonumber
    {
        class Program
        {
             static void Main(string[] args)
             {
                 int a, b, c;
                 Console.WriteLine("ENTER THE VALUE OF A :- ");
                 a = Convert.ToInt32(Console.ReadLine());
                 Console.WriteLine("ENTER THE VALUE OF B :- ");
                 b = Convert.ToInt32(Console.ReadLine());
                 c = a + b;
                 Console.WriteLine("ADDITION OF TWO NUMBER IS :- "+c);
                 Console.ReadLine();
             }
        }
    }
	

Output

	
   ENTER THE VALUE OF A :- 5
   ENTER THE VALUE OF B :- 12
   
   ADDITION OF TWO NUMBER IS :- 17
    
Advertisement here

Share this Page.