C# PROGRAM TO ADD TWO NUMBERS / INTEGERS
C# PROGRAM TO ADD TWO NUMBERS / INTEGERS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
using System; namespace CsharpPrograms { class Program { static void Main(string[] args) { int x; int y; int result; Console.Write("\n Enter the first number to be added: "); x=Convert.ToInt32(Console.ReadLine()); Console.Write("\n Enter the second number to be added: "); y = Convert.ToInt32(Console.ReadLine()); result = x + y; Console.Write("\n The sum of two numbers is: "+result); Console.ReadLine(); } } } |
Sample Output :