What will be the exact definition of leap year? AFAIK "A year which is divisible by 4 is a leap year. But for century years' the years which are divisible by 400 is a leap year."
But that definition makes 100, 200, 300, 400.... upto 1700 NOT LEAP years! But in Gregorian calendar all of them are all leap year, check this out.
You can also try "call 1700" in Linux to verify.
So the correct algorithm for leap years would be:
if ( (year % 4 == 0) && ( year <= 1700 || year % 100 != 0 || year % 400 == 0 ))
printf("%d is a leap year.\n", year);
else
printf("%d is not a leap year.\n", year);
But is this specific to Gregorian calendar? Even if that is the case why is it not mentioned here?
Regards,
PS:The history of Gregorian callender seems interesting check out the September month of 1752.