Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace On_Time_for_the_Exam
- {
- class Program
- {
- static void Main ( string[] args )
- {
- int Chas_Start = int.Parse(Console.ReadLine());
- int Min_Start = int.Parse(Console.ReadLine());
- int Chas_doshal = int.Parse(Console.ReadLine());
- int Min_doshal = int.Parse(Console.ReadLine());
- TimeSpan Vreme_Start = new TimeSpan(Chas_Start, Min_Start, 0);
- TimeSpan Vreme_Doshal = new TimeSpan(Chas_doshal, Min_doshal, 0);
- TimeSpan TS_Result = Vreme_Start - Vreme_Doshal;
- string result = "";
- if ((TS_Result.Hours == 0 && TS_Result.Minutes >= -30 && TS_Result.Minutes<=30 && TS_Result.Minutes>=0))
- {
- result = "On time";
- }
- else if (Vreme_Doshal < Vreme_Start.Add(new TimeSpan(0, -30, 0)))
- {
- result = "Early";
- }
- else
- {
- result = "Late";
- }
- if (TS_Result.Hours == 0)
- {
- if (TS_Result.Ticks > 0)
- {
- Console.WriteLine("{0}\n{1} minutes before the start", result, Math.Abs(TS_Result.Minutes));
- }
- else
- {
- Console.WriteLine("{0}\n{1} minutes after the start", result, Math.Abs(TS_Result.Minutes));
- }
- }
- else
- {
- if (TS_Result.Ticks > 0)
- {
- Console.WriteLine("{0}\n{1}:{2:00} hours before the start", result, Math.Abs(TS_Result.Hours), Math.Abs(TS_Result.Minutes));
- }
- else
- {
- Console.WriteLine("{0}\n{1}:{2:00} hours after the start", result, Math.Abs(TS_Result.Hours), Math.Abs(TS_Result.Minutes));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement