Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _1OnTimeforExam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int ExamHour = int.Parse(Console.ReadLine());
- int ExamMin = int.Parse(Console.ReadLine());
- int ArriveHour = int.Parse(Console.ReadLine());
- int ArriveMin = int.Parse(Console.ReadLine());
- string early = "Early";
- string ontime = "On time";
- string late = "Late";
- var examtime = (ExamHour * 60) + ExamMin;
- var arrivetime = (ArriveHour * 60) + ArriveMin;
- var totaldifference = arrivetime - examtime;
- if (totaldifference > 0)
- {
- if (totaldifference <= 59)
- {
- Console.WriteLine(late);
- Console.WriteLine("{0} minutes after the start", totaldifference);
- }
- else if (totaldifference >= 60)
- {
- Console.WriteLine(late);
- Console.WriteLine("{0}:{1:00} hours after the start", (arrivetime - examtime) / 60, (arrivetime - examtime) % 60);
- }
- }
- if (totaldifference < 0)
- {
- if (Math.Abs(totaldifference) <= 30)
- {
- Console.WriteLine(ontime);
- Console.WriteLine("{0} minutes before the start", Math.Abs(totaldifference));
- }
- else if (Math.Abs(totaldifference) > 30 && Math.Abs(totaldifference) <= 59)
- {
- Console.WriteLine(early);
- Console.WriteLine("{0} minutes before the start", Math.Abs(totaldifference));
- }
- else if (Math.Abs(totaldifference) >= 60)
- {
- Console.WriteLine(early);
- Console.WriteLine("{0}:{1:00} hours before the start", (examtime - arrivetime) / 60, (examtime - arrivetime) % 60);
- }
- }
- else if (totaldifference == 0)
- { Console.WriteLine(ontime); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement