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 hoursExam = int.Parse(Console.ReadLine());
- int minutesExam = int.Parse(Console.ReadLine());
- int hoursArrive = int.Parse(Console.ReadLine());
- int minutesArrive = int.Parse(Console.ReadLine());
- var timeExam = hoursExam * 60 + minutesExam;
- var timeArrive = hoursArrive * 60 + minutesArrive;
- var timeDiff = Math.Abs(timeExam - timeArrive);
- var hourDiff = timeDiff / 60;
- var minutesDiff = timeDiff % 60;
- if (timeArrive > timeExam)
- {
- Console.WriteLine("Late");
- if (timeDiff < 60)
- { Console.WriteLine("{0} minutes after the start", timeDiff); }
- else
- { Console.WriteLine("{0}:{1:D2} hours after the start", hourDiff, minutesDiff); }
- }
- else if ((timeExam - timeArrive) >= 0 && (timeExam - timeArrive) <= 30)
- {
- Console.WriteLine("On time");
- Console.WriteLine("{0} minutes before the start", timeDiff);
- }
- else if ((timeExam - timeArrive) > 30)
- {
- Console.WriteLine("Early");
- if (timeDiff < 60)
- { Console.WriteLine("{0} minutes before the start", timeDiff); }
- else
- { Console.WriteLine("{0}:{1:D2} hours before the start", hourDiff, minutesDiff); }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement