Displaying the sum of two numbers input from the keyboard.
using System;
public class Addition
{
public static void Main( string[] args )
{
int number1;
int number2;
int sum;
Console.Write( "Enter first integer: " );
number1 = Convert.ToInt32( Console.ReadLine() );
Console.Write( "Enter second integer: " );
number2 = Convert.ToInt32( Console.ReadLine() );
sum = number1 + number2;
Console.WriteLine( "Sum is {0}", sum );
}
}
Related examples in the same category