Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace On_Time_for_the_Exam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int correctHour = int.Parse(Console.ReadLine());
- int correctMinutes = int.Parse(Console.ReadLine());
- int arriveHour = int.Parse(Console.ReadLine());
- int arriveMinutes = int.Parse(Console.ReadLine());
- int correctTime = correctHour * 60 + correctMinutes;
- int arriveTime = arriveHour * 60 + arriveMinutes;
- int earlyMinutes = correctTime - 30;
- int diff = 0;
- if (arriveTime == correctTime)
- {
- Console.WriteLine("On time");
- }
- else if (arriveTime > correctTime)
- {
- Console.WriteLine("Late");
- diff = arriveTime - correctTime;
- int hours = diff / 60;
- int minutes = diff % 60;
- if (hours > 0)
- {
- Console.WriteLine("{0}:{1:D2} hours after the start", hours, minutes);
- }
- else
- {
- Console.WriteLine("{0} minutes after the start", minutes);
- }
- }
- else if (arriveTime >= earlyMinutes)
- {
- Console.WriteLine("On time");
- diff = correctTime - arriveTime;
- int hours = diff / 60;
- int minutes = diff % 60;
- if (hours > 0)
- {
- Console.WriteLine("{0}:{1:D2} hours before the start", hours, minutes);
- }
- else
- {
- Console.WriteLine("{0} minutes before the start", minutes);
- }
- }
- else
- {
- Console.WriteLine("Early");
- diff = correctTime - arriveTime;
- int hours = diff / 60;
- int minutes = diff % 60;
- if (hours > 0)
- {
- Console.WriteLine("{0}:{1:D2} hours before the start", hours, minutes);
- }
- else
- {
- Console.WriteLine("{0} minutes before the start", minutes);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement