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 hhStart = int.Parse(Console.ReadLine());
- int mmStart = int.Parse(Console.ReadLine());
- int hhCome = int.Parse(Console.ReadLine());
- int mmCome = int.Parse(Console.ReadLine());
- int allStart = hhStart * 60 + mmStart;
- int allCome = hhCome * 60 + mmCome;
- string LateEarly = string.Empty;
- if (allCome <= allStart)
- {
- if (allStart - 30 > allCome)
- {
- LateEarly = "Early";
- }
- else
- {
- LateEarly = "On time";
- }
- }
- else
- {
- LateEarly = "Late";
- }
- if (allStart > allCome)
- {
- }
- Console.WriteLine($"{LateEarly}");
- double mm = Math.Abs((allStart - allCome) % 60);
- double hh = Math.Abs((allStart - allCome) / 60);
- if (allCome < allStart)
- {
- if (hh!=0 && mm >= 0 && mm < 10)
- {
- Console.WriteLine($"{hh:f0}:0{mm} hours before the start");
- }
- else if(hh != 0)
- {
- Console.WriteLine($"{hh:f0}:{mm} hours before the start");
- }
- else if (hh==0)
- {
- Console.WriteLine($"{mm} minutes before the start");
- }
- }
- else if (allCome > allStart)
- {
- if (hh != 0 && mm >= 0 && mm < 10)
- {
- Console.WriteLine($"{hh:f0}:0{mm} hours after the start");
- }
- else if (hh != 0)
- {
- Console.WriteLine($"{hh:f0}:{mm} hours after the start");
- }
- else if (hh == 0)
- {
- Console.WriteLine($"{mm} minutes after the start");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment