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 OnTimeForExam
- {
- class OnTimeForExam
- {
- static void Main(string[] args)
- {
- int startHours = int.Parse(Console.ReadLine());
- int startMinutes = int.Parse(Console.ReadLine());
- int hours = int.Parse(Console.ReadLine());
- int minutes = int.Parse(Console.ReadLine());
- TimeSpan startExam = new TimeSpan(startHours , startMinutes , 0);
- TimeSpan studentCom = new TimeSpan(hours , minutes , 0);
- TimeSpan time = startExam - studentCom;
- if(time.TotalMinutes < 0)
- {
- Console.WriteLine("Late");
- }
- else if(time.Minutes > 30 || time.Hours > 0)
- {
- Console.WriteLine("Early");
- }
- else
- {
- Console.WriteLine("On time");
- }
- if(time.TotalMinutes != 0)
- {
- if(time.TotalMinutes <= 59 && time.TotalMinutes > 0)
- {
- Console.WriteLine("{0} minutes before the start", time.TotalMinutes);
- }
- else if(time.TotalMinutes > 59)
- {
- Console.WriteLine("{0:%h}:{0:mm} hours before the start" , time);
- }
- else if(time.TotalMinutes < 0 && time.TotalMinutes >= -59)
- {
- Console.WriteLine("{0} minutes after the start" ,Math.Abs(time.TotalMinutes));
- }
- else
- {
- Console.WriteLine("{0:%h}:{0:mm} hours after the start" , time);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement