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