Advertisement
AnastasiyaG

Untitled

Feb 7th, 2020
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Methods
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8.  
  9. string command = Console.ReadLine();
  10. double a = double.Parse(Console.ReadLine());
  11. double b = double.Parse(Console.ReadLine());
  12. switch (command)
  13. { case "add":
  14. Add(a, b);
  15. break;
  16. case "multipy":
  17. multiply(a, b);
  18. break;
  19. case "divide":
  20. divide(a, b);
  21. break;
  22. case "subtract":
  23. sub(a, b);
  24. break;
  25. }
  26. }
  27.  
  28. static void sub(double a, double b)
  29. {
  30. Console.WriteLine(a-b);
  31. }
  32.  
  33. static void divide(double a, double b)
  34. {
  35. Console.WriteLine(a/b);
  36.  
  37. }
  38.  
  39. static void multiply(double a, double b)
  40. {
  41. Console.WriteLine(a*b);
  42. }
  43.  
  44. static void Add(double a, double b)
  45. {
  46. Console.WriteLine(a+b);
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement