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 ConsoleApp17
- {
- class Program
- {
- static void Main(string[] args)
- {
- int examHours = int.Parse(Console.ReadLine());
- int examMinutes = int.Parse(Console.ReadLine());
- int arrivalHours = int.Parse(Console.ReadLine());
- int arrivalMinutes = int.Parse(Console.ReadLine());
- int examTime = (examHours * 60) + examMinutes;
- int arivalTime = (arrivalHours * 60) + arrivalMinutes;
- int timeDifference = examTime - arivalTime;
- int otherdifference = arivalTime - examTime;
- if (timeDifference >= 0 && timeDifference <= 30)
- {
- if (timeDifference == 0)
- {
- Console.WriteLine("On time");
- }
- else if (timeDifference > 0 && timeDifference <= 30)
- {
- Console.WriteLine("On time");
- Console.WriteLine("{0} minutes before the start", timeDifference);
- }
- }
- else if (timeDifference > 30 && timeDifference <= 59)
- {
- Console.WriteLine("Early");
- Console.WriteLine("{0} minutes before the start", timeDifference);
- }
- else if (timeDifference > 59)
- {
- int hours = timeDifference / 60;
- int min = timeDifference % 60;
- Console.WriteLine("Early");
- if (min < 10)
- {
- Console.WriteLine("{0}:0{1} hours before the start", hours, min);
- }
- else
- {
- Console.WriteLine("{0}:{1} hours before the start", hours, min);
- }
- }
- else if (otherdifference <= 59)
- {
- Console.WriteLine("Late");
- Console.WriteLine("{0} minutes after the start", otherdifference);
- }
- else if (otherdifference > 59)
- {
- int hours = otherdifference / 60;
- int min = otherdifference % 60;
- Console.WriteLine("Late");
- if (min < 10)
- {
- Console.WriteLine("{0}:0{1} hours after the start", hours, min);
- }
- else
- {
- Console.WriteLine("{0}:{1} hours after the start", hours, min);
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment