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 OnTimeForTheExam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int hoursExam = int.Parse(Console.ReadLine());
- int minutesExam = int.Parse(Console.ReadLine());
- int hoursComing = int.Parse(Console.ReadLine());
- int minutesComing = int.Parse(Console.ReadLine());
- int minutesFromHoursExam = hoursExam * 60;
- int timeExamInMinutes = minutesFromHoursExam + minutesExam;
- int minutesFromHoursGoming = hoursComing * 60;
- int timeGomingInMinutes = minutesFromHoursGoming + minutesComing;
- if (timeGomingInMinutes > timeExamInMinutes)
- {
- double timeLate = timeGomingInMinutes - timeExamInMinutes;
- if (timeLate < 60)
- {
- Console.WriteLine("Late");
- Console.WriteLine("{0} minutes after the start", timeLate);
- }
- else if (timeLate >= 60)
- {
- double hoursLate = Math.Floor (timeLate / 60);
- double minutesLate = timeLate % 60;
- Console.WriteLine("Late");
- Console.WriteLine("{0}:{1:00} hours after the start", hoursLate, minutesLate);
- }
- }
- else if ((timeGomingInMinutes + 30 >= timeExamInMinutes) && (timeGomingInMinutes <= (timeExamInMinutes + 30)))
- {
- double timeOnTime = timeExamInMinutes - timeGomingInMinutes;
- Console.WriteLine("On time");
- Console.WriteLine("{0} minutes before the start", timeOnTime);
- }
- else if (timeGomingInMinutes < timeExamInMinutes)
- {
- var timeEarly = timeExamInMinutes - timeGomingInMinutes;
- if (timeEarly < 60)
- {
- Console.WriteLine("Early");
- Console.WriteLine("{0} minutes before the start", timeEarly);
- }
- else if (timeEarly >= 60)
- {
- var hoursEarly = timeEarly / 60;
- var minutesEarly = timeEarly % 60;
- Console.WriteLine("Early");
- Console.WriteLine("{0} {1:00} hours before the start", hoursEarly, minutesEarly);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement