Advertisement
Jann24

Zad1

Nov 20th, 2024
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. //ZAD 1
  2. int n = int.Parse(Console.ReadLine());
  3. string time = Console.ReadLine();
  4.  
  5. double taxiPricePerKm = 0.79;
  6. double busPricePerKm = 0.09;
  7. double trainPricePerkm = 0.06;
  8.  
  9. if (time == "night")
  10. {
  11.     taxiPricePerKm = 0.90;
  12. }
  13.  
  14.  
  15. if (n >= 100)
  16. {
  17.     Console.WriteLine($"{n * trainPricePerkm:f2}");
  18. }
  19. else if (n >= 20 && n < 100)
  20. {
  21.     Console.WriteLine($"{n * busPricePerKm:f2}");
  22. }
  23. else
  24. {
  25.     Console.WriteLine($"{n * taxiPricePerKm + 0.7:f2}");
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement