Friday, 10 February 2017

Adding two integers in C#

using System;
using
System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplications
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the first number : ");
            int first = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter the second number : ");
            int second = int.Parse(Console.ReadLine());
            int sum = first + second;
            Console.WriteLine("The result is: {0}", sum);
            Console.ReadKey();
        }
    }
}

No comments:

Post a Comment