// Implementing a calculator in
// C# using switch statement.
using System;
using System.Text;
using System.Threading.Tasks;
namespace calculator_c_sharp
{
class Program
{
static void Main(string[] args)
{
string value;
do
{
int res;
Console.Write("Enter first number:");
int num1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter second number:");
int num2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter symbol(/,+,-,*):");
string symbol = Console.ReadLine();
switch (symbol)
{
case "+":
res = num1 + num2;
Console.WriteLine("Addition:" + res);
break;
case "-":
res = num1 - num2;
Console.WriteLine("Subtraction:" + res);
break;
case "*":
res = num1 * num2;
Console.WriteLine("Multiplication:" + res);
break;
case "/":
res = num1 / num2;
Console.WriteLine("Division:" + res);
break;
default:
Console.WriteLine("Wrong input");
break;
}
Console.ReadLine();
Console.Write("Do you want to continue(y/n):");
value = Console.ReadLine();
}
while (value=="y" || value=="Y");
}
}
}
Ly8gSW1wbGVtZW50aW5nIGEgY2FsY3VsYXRvciBpbiAKLy8gQyMgdXNpbmcgc3dpdGNoIHN0YXRlbWVudC4KdXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLlRocmVhZGluZy5UYXNrczsKCm5hbWVzcGFjZSBjYWxjdWxhdG9yX2Nfc2hhcnAKewoJY2xhc3MgUHJvZ3JhbQoJewoJCXN0YXRpYyB2b2lkIE1haW4oc3RyaW5nW10gYXJncykKCQl7CgkJCXN0cmluZyB2YWx1ZTsKCQkJZG8KCQkJewoJCQkJaW50IHJlczsKCQkJCUNvbnNvbGUuV3JpdGUoIkVudGVyIGZpcnN0IG51bWJlcjoiKTsKCQkJCWludCBudW0xID0gQ29udmVydC5Ub0ludDMyKENvbnNvbGUuUmVhZExpbmUoKSk7CgkJCQlDb25zb2xlLldyaXRlKCJFbnRlciBzZWNvbmQgbnVtYmVyOiIpOwoJCQkJaW50IG51bTIgPSBDb252ZXJ0LlRvSW50MzIoQ29uc29sZS5SZWFkTGluZSgpKTsKCQkJCUNvb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