Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace OnTimeForExam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int hourExam = int.Parse(Console.ReadLine());
- int minutesExam = int.Parse(Console.ReadLine());
- int hourArrival = int.Parse(Console.ReadLine());
- int minuteArrival = int.Parse(Console.ReadLine());
- double timeExam = hourExam * 60 + minutesExam;
- double timeArrival = hourArrival * 60 + minuteArrival;
- double early = timeExam - timeArrival;
- if (timeExam > timeArrival)
- {
- if (early <= 30)
- {
- Console.WriteLine("On time");
- }
- else
- {
- Console.WriteLine("Early");
- }
- }
- else if (timeExam == timeArrival)
- {
- Console.WriteLine("On time");
- }
- else
- {
- Console.WriteLine("Late");
- }
- if (early >=1 && early < 60)
- {
- Console.WriteLine($"{early} minutes before the start");
- }
- else if (early >=60 )
- {
- double earlyHours = early / 60;
- double earlyMinutes = early % 60;
- Console.WriteLine($"{earlyHours}: {earlyMinutes:D2} hours before the start");
- }
- else if (early <0 && early > -60)
- {
- early = Math.Abs(early);
- Console.WriteLine($"{early} minutes after the start");
- }
- else if (early <= -60)
- {
- early = Math.Abs(early);
- double lateHours = early / 60;
- double lateMinutes = early % 60;
- Console.WriteLine($"{lateHours}: {lateMinutes:D2} hours after the start");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement