Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _04.BestPlaneTickets
- {
- class BestPlaneTickets
- {
- static void Main(string[] args)
- {
- string numTicket = Console.ReadLine();
- double leva = 1.96;
- double lowestStay = double.MaxValue;
- double bestPrice = double.MinValue;
- string bestTicket = "";
- while (numTicket != "End")
- {
- double price = double.Parse(Console.ReadLine());
- double minutesStay = double.Parse(Console.ReadLine());
- price = price * leva;
- if (minutesStay < lowestStay)
- {
- bestPrice = price;
- bestTicket = numTicket;
- lowestStay = minutesStay;
- }
- numTicket = Console.ReadLine();
- }
- Console.WriteLine($"Ticket found for flight {bestTicket} costs {bestPrice:F2} leva with {lowestStay / 60}h {lowestStay % 60}m stay");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement