C# Program to add two numbers


In this program, You will learn how to add two numbers in C#.


20 = 10 + 10

30 = 10 + 20


Example: How to add two numbers in C#

Run it Now
using System;
public class Program
{
	public static void Main(string[] args)
	{
		int x, y, s;

		Console.Write("Enter First Number :");
		x = Convert.ToInt32(Console.ReadLine());

		Console.Write("\nEnter Second Number :");
		y = Convert.ToInt32(Console.ReadLine());

		s = x + y;
		Console.WriteLine("\nThe Sum is :" + s);

	}
}

Output:

Enter First Number :10
Enter Second Number :20
The Sum is : 30