Add two numbers (a simpler approach)
// Add 2 numbers in C#
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int no1, no2;
Console.Write("Enter 1st number: ");
no1 = Int32.Parse(Console.ReadLine());
Console.Write("Enter 2nd number: ");
no2 = Int32.Parse(Console.ReadLine());
Console.WriteLine("Sum: {0}", no1 + no2);//Change the position of {0} to see what it does.
}
}
}
No comments:
Post a Comment