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 examHour = int.Parse(Console.ReadLine());
- int examMin = int.Parse(Console.ReadLine());
- int arriveHour = int.Parse(Console.ReadLine());
- int ariveMin = int.Parse(Console.ReadLine());
- int hourDiff = ((examHour * 60) + examMin) - ((arriveHour * 60) + ariveMin);
- string txt = " ";
- if(hourDiff < 0 )
- {
- txt = "Late";
- }
- else if( hourDiff >= 0 && hourDiff <= 30)
- {
- txt = "On time";
- }
- else
- {
- txt = "Early";
- }
- Console.WriteLine(txt);
- int hours = hourDiff / 60;
- hours *= 60;
- if( hourDiff > 0 && hourDiff < 60)
- {
- Console.WriteLine($"{hourDiff} minutes before the start");
- }
- else if( hourDiff >= 60 )
- {
- Console.WriteLine($"{hourDiff/60}:{hourDiff-hours} hours before the start");
- }
- else if (hourDiff < 0 && hourDiff > - 60)
- {
- Console.WriteLine($"{hourDiff*-1} minutes after the start");
- }
- else if (hourDiff <= -60)
- {
- Console.WriteLine($"{hourDiff / 60 * -1}:{(hourDiff - hours)*-1} hours after the start");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement