Advertisement
AnastasiyaG

Untitled

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