code:
using System;
namespace CsharpPrograms
{
class Program
{
static void Main(string[] args)
{
int x;
int y;
int addi,sub,mult,div;
Console.Write("\n Enter the first number: ");
x=Convert.ToInt32(Console.ReadLine());
Console.Write("\n Enter the second number: ");
y = Convert.ToInt32(Console.ReadLine());
me:
Console.WriteLine("\n Enter your choice: \n1:addition \n2:subtraction \n3:multiplication \n4:division");
String exp=Console.ReadLine();
switch(exp)
{
case "1":
case "addition":
addi = x + y;
Console.Write("\n The sum of two numbers is: "+addi);
goto me;
case "2":
case "subtraction":
sub = x - y;
Console.Write("\n The difference of two numbers is: "+sub);
goto me;
case "3":
case "multiplication":
mult = x * y;
Console.Write("\n The multiplication of two numbers is: "+mult);
goto me;
case "4":
case "division":
div = x / y;
Console.Write("\n The division of two numbers is: "+div);
goto me;
default:
Console.Write("\n Something went wrong... ");
break;
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment