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 ConsoleApplication11
- {
- class Program
- {
- static void Main(string[] args)
- {
- int examHour = int.Parse(Console.ReadLine());
- int examMinute = int.Parse(Console.ReadLine());
- int arrivingHour = int.Parse(Console.ReadLine());
- int arrivingMinute = int.Parse(Console.ReadLine());
- int diff = ((examHour * 60) + examMinute) - ((arrivingHour * 60) + arrivingMinute);
- int hour = diff / 60;
- int minute = diff % 60;
- if (diff == 0)
- {
- Console.WriteLine("On Time");
- }
- else if (diff >= 1 && diff <= 30)
- {
- Console.WriteLine("On Time");
- Console.WriteLine("{0} minutes before the start", diff);
- }
- else if (diff > 30 && diff <= 59)
- {
- Console.WriteLine("Early");
- Console.WriteLine("{0} minutes before the start", diff);
- }
- else if (diff == 60)
- {
- Console.WriteLine("Early");
- Console.WriteLine("{0}:00 hours before the start", hour);
- }
- else if (diff > 60 && diff <= 69)
- {
- Console.WriteLine("Early");
- Console.WriteLine("{0}:0{1} hours before the start", hour, minute);
- }
- else if (diff >= 70)
- {
- Console.WriteLine("Early");
- Console.WriteLine("{0}:{1} hours before the start", hour, minute);
- }
- else if (diff < 0 && diff >= -59)
- {
- Console.WriteLine("Late");
- Console.WriteLine("{0} minutes after the start", Math.Abs(diff));
- }
- else if (diff == -60)
- {
- Console.WriteLine("Late");
- Console.WriteLine("{0}:00 hours after the start", Math.Abs(hour));
- }
- else if (diff < -60 && diff >= -69)
- {
- Console.WriteLine("Late");
- Console.WriteLine("{0}:0{1} hours after the start", Math.Abs(hour), Math.Abs(minute));
- }
- else if (diff <= -70)
- {
- Console.WriteLine("Late");
- Console.WriteLine("{0}:{1} hours after the start", Math.Abs(hour), Math.Abs(minute));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement