Category >
CSHARP
|| Published on :
Wednesday, October 28, 2020 || Views:
653
||
read two integer numbers and print the sum
Here Pawan Kumar will explain how to read two integer numbers and print the sum in C#
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the first number:");
string s1 = Console.ReadLine();
int a1 = Convert.ToInt32(s1);
Console.WriteLine("Enter the second number:");
string s2 = Console.ReadLine();
int a2 = Convert.ToInt32(s2);
int s3 = a1 + a2;
Console.WriteLine("The sum is:" + s3);
Console.ReadLine();
}
}
}