Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace OnTimeForTheExam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int examHour = int.Parse(Console.ReadLine());
- int examMinutes = int.Parse(Console.ReadLine());
- int arrivalHour = int.Parse(Console.ReadLine());
- int arrivalMinutes = int.Parse(Console.ReadLine());
- int timeExam = examHour * 60 + examMinutes;
- int timeArrival = arrivalHour * 60 + arrivalMinutes;
- int difference = 0;
- int hours = 0;
- int minutes = 0;
- if (timeArrival > timeExam)
- {
- Console.WriteLine("Late");
- difference = timeArrival - timeExam;
- if (difference < 60)
- {
- Console.WriteLine($"{difference} minutes after the start");
- }
- else if (difference >= 60)
- {
- hours = difference / 60;
- minutes = difference % 60;
- Console.WriteLine($"{hours}:{minutes:d2} hours after the start");
- }
- }
- else if (timeArrival == timeExam || (timeArrival >= timeExam - 30 && timeArrival < timeExam))
- {
- Console.WriteLine("On time");
- difference = timeExam - timeArrival;
- if (difference <= 30)
- {
- Console.WriteLine($"{difference} minutes before the start");
- }
- }
- else if (timeArrival < timeExam - 30)
- {
- Console.WriteLine("Early");
- difference = timeExam - timeArrival;
- if (difference < 60)
- {
- Console.WriteLine($"{difference} minutes before the start");
- }
- else if (difference >= 60)
- {
- hours = difference / 60;
- minutes = difference % 60;
- Console.WriteLine($"{hours}:{minutes:d2} hours before the start");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement