Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConditionalStatementsAdvanced
- {
- class Program
- {
- static void Main(string[] args)
- {
- int examHour = int.Parse(Console.ReadLine());
- int examMinute = int.Parse(Console.ReadLine());
- int arriveHour = int.Parse(Console.ReadLine());
- int arriveMinute = int.Parse(Console.ReadLine());
- int examMinutes = examHour * 60 + examMinute; //часът на изпита в минути
- int arriveMinutes = arriveHour * 60 + arriveMinute; //часът на пристигане в минути
- if (arriveMinutes > examMinutes)
- {
- //Late
- Console.WriteLine("Late");
- //за закъснение под час
- int late = arriveMinutes - examMinutes; //закъснение
- if(late < 60)
- {
- Console.WriteLine($"{late} minutes after the start");
- }
- else
- {
- int lateHour = late / 60;
- int lateMinute = late % 60;
- Console.WriteLine($"{lateHour}:{lateMinute:D2} hours after the start");
- }
- }
- else if (arriveMinutes == examMinutes || examMinutes - arriveMinutes <= 30)
- {
- //On time
- Console.WriteLine("On time");
- //точно на време -> не принтираме нищо допълнително
- // подраняваме с <= 30 мин -> принтираме с колко минути подраняваме
- if (examMinutes - arriveMinutes <= 30 && examMinutes != arriveMinutes)
- {
- Console.WriteLine($"{examMinutes - arriveMinutes} minutes before the start");
- }
- }
- else if (examMinutes - arriveMinutes > 30)
- {
- //Early
- Console.WriteLine("Early");
- //подраняваме с по-малко от час
- int early = examMinutes - arriveMinutes; //подраняване
- if (early < 60)
- {
- Console.WriteLine($"{early} minutes before the start");
- }
- else //подраняване с 1 час или повече early >= 60
- {
- int earlyHour = early / 60;
- int earlyMinute = early % 60;
- Console.WriteLine($"{earlyHour}:{earlyMinute:D2} hours before the start");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement