C# program to take two numbers from user and add those two numbers


Following program shows you how to take two numbers from user and add those two numbers.
In this program we take two numbers from user using Console method and add those two numbers

using System;

class MainClass {
  public static void Main (string[] args) {
    Console.WriteLine("Enter first number:");
        int input1 = Convert.ToInt32 (Console.ReadLine());
    Console.WriteLine("Enter second number:");
		int input2 = Convert.ToInt32(Console.ReadLine());
    int result = input1 + input2;
        Console.WriteLine("Sum of the given two numbers is: " + result);
  }
}

Output:

Enter first number:
 12
Enter second number:
 15
Sum of the given two numbers is: 27