Now I know that if you divide the year by 4 and it comes back with a whole integer number that it is a leap year.
First- this is actually not the entire rule.
A year is a leap year if it's evenly divisible by 4 but not by 100
if (year modulo 4 is 0) and (year modulo 100 is not 0) or (year modulo 400 is 0)
then is_leap_year
else
not_leap_year
Anyway- the answer to your problem is the C# modulus operator, %: for example, this function would determine if a year was a leapyear:
private bool IsLeap(int year)
{
if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0))
return true;
else
return false;
}
However- a better solution is to simply use the .NET framework. System.DateTime.IsLeapYear(int) will tell you if a specified year is a leap-year.