Advertisement
zorry

Untitled

Jun 28th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Transport_Price
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. var n = int.Parse(Console.ReadLine());
  10. string p = Console.ReadLine();
  11. double t = 0, a, tr;
  12. if (p == "day")
  13. t = n * 0.79 + 0.70;
  14. else if (p == "night")
  15. t = n * 0.90 + 0.70;
  16. else
  17. Console.WriteLine("invalid time");
  18. a = n * 0.09;
  19. tr = n * 0.06;
  20. if (n < 20)
  21. Console.WriteLine(t);
  22. else if (n >= 20 && n < 100)
  23. if (t < a)
  24. Console.WriteLine(t);
  25. else
  26. Console.WriteLine(a);
  27. else if (n >= 100)
  28. {
  29. var price = Math.Min(Math.Min(t, a), tr);
  30. Console.WriteLine(price);
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement