Advertisement
Guest User

Untitled

a guest
Jan 30th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1.  
  2. namespace ConsoleApplication3
  3. {
  4. using System;
  5. class Calculator
  6. {
  7. static void Main(string[] args)
  8. {
  9. int x = int.Parse(Console.ReadLine());
  10. char function = Console.ReadKey().KeyChar;
  11.  
  12. int y = int.Parse(Console.ReadLine());
  13.  
  14. switch(function)
  15. {
  16. case '+': Console.WriteLine(x + y);
  17. break;
  18. case '-': Console.WriteLine(x - y);
  19. break;
  20. case '*': Console.WriteLine(x * y);
  21. break;
  22. case '/': Console.WriteLine(x / y);
  23. break;
  24.  
  25.  
  26. default: Console.WriteLine("Invalid");
  27. break;
  28. }
  29.  
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement