Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApplication3
- {
- class Calculator
- {
- static void Main(string[] args)
- {
- int x = int.Parse(Console.ReadLine());
- char function = Console.ReadLine()[0];
- int y = int.Parse(Console.ReadLine());
- switch (function)
- {
- case '+':
- Console.WriteLine($"{x} + {y} = {x + y}");
- break;
- case '-':
- Console.WriteLine($"{x} - {y} = {x-y}");
- break;
- case '*':
- Console.WriteLine($"{x} * {y} = {x*y}");
- break;
- case '/':
- Console.WriteLine($"{x} / {y} = {x/y}");
- break;
- default:
- Console.WriteLine("Invalid");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement