C# program to perform the addition of two numbers
Program.cs
int a, b, c;        
Console.WriteLine("———————————————————————————————————————————");
Console.WriteLine("Program to print the addition of two numbers");
Console.WriteLine("———————————————————————————————————————————");
Console.Write("Enter the 1st number ");
a = Convert.ToInt32(Console.ReadLine());
Console.Write("\nEnter the 2nd number ");
b = Convert.ToInt32(Console.ReadLine());
c = a + b;
Console.WriteLine("\nAddition " + c);         
Console.WriteLine("———————————————————————————————————————————");
Output
kodingwindow@kw:~/csharp$ dotnet run
———————————————————————————————————————————
Program to print the addition of two numbers
———————————————————————————————————————————
Enter the 1st number 50

Enter the 2nd number -10

Addition 40
———————————————————————————————————————————
kodingwindow@kw:~/csharp$ 
Advertisement