Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApplication13
- {
- class Program
- {
- static void Main(string[] args)
- {
- double a, b;
- double result;
- int op;
- Console.WriteLine("Enter the 1st number:");
- a = double.Parse(Console.ReadLine());
- Console.WriteLine("Enter the 2nd number:");
- b = double.Parse(Console.ReadLine());
- Console.WriteLine("Enter the operators a & b:");
- Console.WriteLine("\n 1 = +\n 2 = -\n 3 = *\n 4 = /");
- op = Convert.ToInt32(Console.ReadLine());
- switch (op)
- {
- case 1:
- result = a + b;
- break;
- case 2:
- result = a - b;
- break;
- case 3:
- result = a * b;
- break;
- case 4:
- result = a / b;
- break;
- default:
- result = 0;
- break;
- }
- Console.WriteLine("\n result:{0}", result);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement