Program to input 2 numbers and calculate the sum.
using System;
namespace ConsoleApplication2
{
class Test1
{
static void Main(string[] args)
{
//how to input data from keyboard
//Console.ReadLine() this always input data in string format
// how to convert string data to integer or double
//int a=Convert.ToInt32(Console.ReadLine());
int a, b, c;
Console.WriteLine("Enter the values of a");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the values of b");
b = Convert.ToInt32(Console.ReadLine());
c = a + b;
Console.WriteLine("The asnwer =" + c);
}
}
}
No comments:
Post a Comment