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 hourExam = int.Parse(Console.ReadLine());
- int minuteExam = int.Parse(Console.ReadLine());
- int hoursStudent = int.Parse(Console.ReadLine());
- int minuteStudent = int.Parse(Console.ReadLine());
- int examMinutes = hourExam * 60 + minuteExam;
- int studentMinutes = hoursStudent * 60 + minuteStudent;
- int timeDiff = studentMinutes - examMinutes;
- if (timeDiff > 0)
- {
- Console.WriteLine("Late");
- if (timeDiff < 60)
- {
- Console.WriteLine($"{timeDiff} minutes after the start");
- }
- else
- {
- Console.WriteLine($"{timeDiff / 60}:{timeDiff % 60:00} hours after the start");
- }
- }
- else if (timeDiff == 0)
- {
- Console.WriteLine("On time");
- }
- else
- {
- timeDiff = Math.Abs(timeDiff);
- if (timeDiff <= 30)
- {
- Console.WriteLine("On time");
- Console.WriteLine($"{timeDiff} minutes before the start");
- }
- else
- {
- Console.WriteLine("Early");
- if (timeDiff < 60)
- {
- Console.WriteLine($"{timeDiff} minutes before the start");
- }
- else
- {
- Console.WriteLine($"{timeDiff / 60}:{timeDiff % 60:00} hours before the start");
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment