by Simon Deshaies
24. December 2009 04:35
It’s not because it’s complex that I’m posting this and it’s neither because it’s hard to come by. It exist as pseudo code in Wikipedia.
It’s rather because it’s fun. You get to answer a bunch of fun questions. Like is 2010 a leap year? Was I born a leap year?
OK, it’s not like you could not calculate that in your head. But the fun part is how it looks like in C#. You know, C# being the BEST language in the WORLD! ;)
public static bool IsLeapYear(int year)
{
if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0))
return true;
else
return false;
}