Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConvertRadiansToDegrees
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int a = int.Parse(Console.ReadLine());
  14. int b = int.Parse(Console.ReadLine());
  15. string c = Console.ReadLine();
  16.  
  17. switch (c)
  18. {
  19. case "+":
  20. Console.WriteLine("{0} + {1} = {2} - {3}", a, b, a + b, (a + b) % 2 == 0 ? "even" : "odd");
  21. break;
  22. case "-":
  23. Console.WriteLine("{0} - {1} = {2} - {3}", a, b, a - b, (a - b) % 2 == 0 ? "even" : "odd");
  24. break;
  25. case "*":
  26. Console.WriteLine("{0} * {1} = {2} - {3}", a, b, a * b, a * b % 2 == 0 ? "even" : "odd");
  27. break;
  28. }
  29. if (b != 0 && c == "%")
  30. {
  31. Console.WriteLine("{0} % {1} = {2}", a, b, a % b);
  32. }
  33. if (b != 0 && c == "/")
  34. {
  35. Console.WriteLine("{0} / {1} = {2:f2}", a, b, (double)a / b);
  36. }
  37.  
  38. switch (b)
  39. {
  40. case 0:
  41. Console.WriteLine("Cannot divide {0} by zero", a);
  42. break;
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement