07. On Time for the Exam 93/100
Здравейте! Трябва ми малко помощ да открия грешката в кода.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _07.On_Time_for_the_Exam
{
    class Program
    {
        static void Main(string[] args)
        {
            int hourexam = int.Parse(Console.ReadLine());
            int minexam = int.Parse(Console.ReadLine());
            int hourarrival = int.Parse(Console.ReadLine());
            int minarrival = int.Parse(Console.ReadLine());
            hourexam = 60 * hourexam;
            minexam = minexam + hourexam;
            hourarrival = 60 * hourarrival;
            minarrival = minarrival + hourarrival;
            int time = minarrival - minexam;
            int hours = 0;
            if(time>0)
                Console.WriteLine("Late");
            if (time < -30)
                Console.WriteLine("Early");
            else if (time<=0)
                Console.WriteLine("On time");
            if (time <0 & time > -60)
                Console.WriteLine("{0} minutes before the start", Math.Abs(time));
            if (time<=-60)
            {
                while(time<=-60)
                {
                    hours++;
                        time = time + 60;
                }
                if(time>-10)
                Console.WriteLine("{0}:0{1} hours before the start", hours, Math.Abs(time));
                else if (time<=-10)
                    Console.WriteLine("{0}:{1} hours before the start", hours, Math.Abs(time));
            }
            if(time>0 & time <60)
                Console.WriteLine("{0} minutes after the start", (time));
            if(time >=60)
            {
                while (time > 60)
                {
                    hours++;
                    time = time - 60;
                }
                if (time < 10)
                    Console.WriteLine("{0}:0{1} hours after the start", hours, time);
                else if (time >= 10)
                    Console.WriteLine("{0}:{1} hours after the start", hours, (time));
            }
            
        }
    }
}
 
Здравейте. И при мен тази задача дава 93/100 и не зная къде е грашката
using System;
using System;
namespace On_Time_for_the_Exam_new
{
class Program
{
static void Main(string[] args)
{
int examHour = int.Parse(Console.ReadLine());
int examMin = int.Parse(Console.ReadLine());
int arrivalHour = int.Parse(Console.ReadLine());
int arrivalMin = int.Parse(Console.ReadLine());
var examTimeInMin = (examHour * 60) + examMin;
var arrTimeInMin = (arrivalHour * 60) + arrivalMin;
var totalTimeInMin = arrTimeInMin - examTimeInMin;
var arrTimeH = 0;
var arrTimeM = 0;
if (totalTimeInMin < 0 && totalTimeInMin >= -30)
{
arrTimeM = Math.Abs(60 - (arrTimeInMin % 60));
Console.WriteLine("On time");
Console.WriteLine("{0} minutes before the start", arrTimeM);
}
else if (totalTimeInMin < -30 && totalTimeInMin >= -59)
{
arrTimeM = Math.Abs((60 - (arrTimeInMin % 60)) + examMin);
Console.WriteLine("Early");
Console.WriteLine("{0} minutes before the start", arrTimeM);
}
else if (totalTimeInMin < -59)
{
arrTimeH = Math.Abs(totalTimeInMin / 60);
arrTimeM = Math.Abs(totalTimeInMin % 60);
Console.WriteLine("Early");
Console.WriteLine("{0}:{1:00} hours before the start", arrTimeH, arrTimeM);
}
else if (totalTimeInMin > 0 && totalTimeInMin <= 59)
{
arrTimeM = Math.Abs(totalTimeInMin % 60);
Console.WriteLine("Late");
Console.WriteLine("{0} minutes after the start", arrTimeM);
}
else if (totalTimeInMin > 59)
{
arrTimeH = Math.Abs(totalTimeInMin / 60);
arrTimeM = Math.Abs(totalTimeInMin % 60);
Console.WriteLine("Late");
Console.WriteLine("{0}:{1:00} hours after the start", arrTimeH, arrTimeM);
}
else
{
Console.WriteLine("On time");
}
}
}
}