I just need to understand why does minutes%60 works. this code is supposed to get minutes input and tell you how many days,hours,minutes can fit into it (there are 1440 minutes in a day).
using System;
public class Time
{
public static void Main()
{
int minutes = int.Parse(Console.ReadLine());
int days = (minutes/1440);
int hours = (minutes%1440)/60;
Console.WriteLine("days: " + days + " hours: " + hours + " minutes: " + minutes%60);
}
}
Think of y = minutes%1440
this way
int x = (minutes/1440);
int y = minutes - 1440*x
The value of y
holds the remainder of the division minutes/1440