programming-examples/c-sharp/Basic/C# Sharp program to print on screen the output of adding, subtracting, multiplying and dividing of two numbers which will be entered by the user.cs

16 lines
646 B
C#
Raw Normal View History

2019-11-18 14:44:36 +01:00
using System;
public class Exercise7
{
public static void Main()
{
Console.Write("Enter a number: ");
int num1= Convert.ToInt32(Console.ReadLine());
Console.Write("Enter another number: ");
int num2= Convert.ToInt32(Console.ReadLine());
Console.WriteLine("{0} + {1} = {2}", num1, num2, num1+num2);
Console.WriteLine("{0} - {1} = {2}", num1, num2, num1-num2);
Console.WriteLine("{0} x {1} = {2}", num1, num2, num1*num2);
Console.WriteLine("{0} / {1} = {2}", num1, num2, num1/num2);
Console.WriteLine("{0} mod {1} = {2}", num1, num2, num1%num2);
}
}