Saturday, September 28, 2013

C# Program to add Two numbers Csharp

10:25 AM


C# Program to add two numbers Integers 
In this csharp tutorial we add two numbers
First we take two numbers and store them in variables
Then we show the result in output
For this we use console readline and console write line

Program :
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();
        }
    }
}
Output:

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

 

© 2013 1000TechTips. All rights resevered. Designed by Templateism

Back To Top