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;
- using System.Globalization;
- namespace On_Time_For_The_Exam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int HoursExam = int.Parse(Console.ReadLine());
- int MinutesExam = int.Parse(Console.ReadLine());
- int HoursArrival = int.Parse(Console.ReadLine());
- int MinutesArrival = int.Parse(Console.ReadLine());
- int resulthe = HoursExam * 60 + MinutesExam;
- int resultha = HoursArrival * 60 + MinutesArrival;
- int resultminutes = resultha - resulthe;
- int hours = 0;
- if (resultminutes <= 0&&resultminutes>=-30)
- {
- if (resultminutes == -60)
- {
- hours += 1;
- }
- hours = resultminutes / 60;
- resultminutes = resultminutes % 60;
- Console.WriteLine("On time");
- Console.WriteLine("{0} minutes before the start",Math.Abs(resultminutes));
- }
- else if(resultminutes<-30)
- {
- if (resultminutes == -60)
- {
- hours += 1;
- }
- hours = resultminutes / 60;
- resultminutes = resultminutes % 60;
- Console.WriteLine("Early");
- if (Math.Abs(hours) >= Math.Abs(1))
- {
- Console.WriteLine("{0}:{1:00} hours before the start", Math.Abs(hours), Math.Abs(resultminutes));
- }
- else
- {
- Console.WriteLine("{0} minutes before the start", Math.Abs(resultminutes));
- }
- }
- else if(resultminutes>0)
- {
- if (resultminutes == -60)
- {
- hours += 1;
- }
- hours = resultminutes / 60;
- resultminutes = resultminutes % 60;
- Console.WriteLine("Late");
- if (Math.Abs(hours) >= Math.Abs(1))
- {
- Console.WriteLine("{0}:{1:00} hours after the start", Math.Abs(hours), Math.Abs(resultminutes));
- }
- else
- {
- Console.WriteLine("{0} minutes after the start", Math.Abs(resultminutes));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment