Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BestPlaneTicket
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool flight = true;
- double sum = 0;
- int hour = 0;
- int min = 0;
- int newtime= 0;
- string newno = " ";
- double newprice = 0;
- for (int i = 1;flight == true; i++)
- {
- string flightno = Console.ReadLine();
- if (flightno == "End")
- {
- break;
- }
- double flightprice = double.Parse(Console.ReadLine());
- int flightduration = int.Parse(Console.ReadLine());
- if (newtime == 0)
- {
- newtime += flightduration;
- }
- if (flightduration <= newtime)
- {
- newtime = flightduration;
- newprice = flightprice;
- newno = flightno;
- sum = flightprice * 1.96;
- hour = flightduration / 60;
- min = Math.Abs(hour * 60 - flightduration);
- }
- }
- Console.WriteLine($"Ticket found for flight {newno} costs {sum:F2} leva with {hour}h {min}m stay");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement