damesova

Transport

Dec 14th, 2025
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. int n = int.Parse(Console.ReadLine());
  2. string time = Console.ReadLine();
  3. double price = 0;
  4.  
  5.  
  6. if (n < 20) // Такси
  7. {
  8.  
  9.     if (time == "day")
  10.     {
  11.         price = 0.7 + n * 0.79;
  12.     }
  13.     else
  14.     {
  15.         price = 0.7 + n * 0.9;
  16.     }
  17. }
  18. else if (n < 100) // Автобус
  19. {
  20.     price = n * 0.09;
  21. }
  22. else // Влак
  23. {
  24.     price = n * 0.06;
  25. }
  26.  
  27. Console.WriteLine($"{price:F2}");
Advertisement
Add Comment
Please, Sign In to add comment