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 _07.On_Time_for_the_Exam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int examTimeHour = int.Parse(Console.ReadLine());
- int examTimeMinute = int.Parse(Console.ReadLine());
- int arrivalTimeHour = int.Parse(Console.ReadLine());
- int arrivalTimeMinute = int.Parse(Console.ReadLine());
- int examTimeOnlyMinutes = (examTimeHour * 60) + examTimeMinute;
- int arrivalTimeOnlyMinutes = (arrivalTimeHour * 60) + arrivalTimeMinute;
- if ((examTimeOnlyMinutes > arrivalTimeOnlyMinutes) && (examTimeOnlyMinutes - arrivalTimeOnlyMinutes > 30))
- {
- int tooEarlyMinutes = examTimeOnlyMinutes - arrivalTimeOnlyMinutes;
- int tooEarlyHours = 0;
- int tooEarlyMinutes1 = 0;
- if (tooEarlyMinutes > 59)
- {
- tooEarlyHours = tooEarlyMinutes / 60;
- tooEarlyMinutes1 = tooEarlyMinutes % 60;
- if (tooEarlyMinutes1 <= 9)
- {
- Console.WriteLine("Early");
- Console.WriteLine($"{tooEarlyHours}:0{tooEarlyMinutes1} hours before the start");
- }
- else
- {
- Console.WriteLine("Early");
- Console.WriteLine($"{tooEarlyHours}:{tooEarlyMinutes1} hours before the start");
- }
- }
- else
- {
- Console.WriteLine("Early");
- Console.WriteLine($"{tooEarlyMinutes} minutes before the start");
- }
- }
- else if ((examTimeOnlyMinutes > arrivalTimeOnlyMinutes) && (examTimeOnlyMinutes - arrivalTimeOnlyMinutes <= 30))
- {
- Console.WriteLine("On time");
- Console.WriteLine($"{examTimeOnlyMinutes - arrivalTimeOnlyMinutes} minutes before the start");
- }
- else if (examTimeOnlyMinutes - arrivalTimeOnlyMinutes == 0)
- {
- Console.WriteLine("On time");
- }
- else if (examTimeOnlyMinutes < arrivalTimeOnlyMinutes && (examTimeOnlyMinutes - arrivalTimeOnlyMinutes <= 30))
- {
- int tooLateMinutes = arrivalTimeOnlyMinutes - examTimeOnlyMinutes;
- int tooLateHours = 0;
- int tooLateMinutes1 = 0;
- if (tooLateMinutes > 59)
- {
- tooLateHours = tooLateMinutes / 60;
- tooLateMinutes1 = tooLateMinutes % 60;
- if (tooLateMinutes1 <= 9)
- {
- Console.WriteLine("Late");
- Console.WriteLine($"{tooLateHours}:0{tooLateMinutes1} hours after the start");
- }
- else
- {
- Console.WriteLine("Late");
- Console.WriteLine($"{tooLateHours}:{tooLateMinutes1} hours after the start");
- }
- }
- else
- {
- Console.WriteLine("Late");
- Console.WriteLine($"{tooLateMinutes} minutes after the start");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment