Saturday, 17 March 2018

c# Program for SUM of Two Numbers

PROGRAM:(AdditionEx.cs)

using System;
namespace Trainning
{
class AdditionEx
{
static void Main()
{
int a,b,sum; //you can declare any data type like float,double...
Console.WriteLine("Enter the Two values");
a=Convert.ToInt32(Console.ReadLine()); //input from keyboard
b=Convert.ToInt32(Console.ReadLine());
sum=a+b;
Console.WriteLine("Sum of Two Values"+sum);     //To print the text with value                                                                                                                       //stored  in  variable sum
}

}
}

OUTPUT:


Program Explanation:
       Above program for adding two numbers and input from the user

No comments:

Post a Comment