Cliff Woolley <[EMAIL PROTECTED]> writes: > --- [EMAIL PROTECTED] wrote: > > +/* Leap year is any year divisible by four, but not by 100 unless also > > + * divisible by 400 > > + */ > > +#define IsLeapYear(y) ((!(y % 4)) ? (((!(y % 400)) && (y % 100)) ? 1 : 0) > > : 0) > > + > > If y is divisible evenly by 400, it's automatically divisible by 100... you > don't need to > check both. =-)
It's also divisible by 4, but that's not the point. :) I think the the rule is: every fourth year is a leap year, BUT, every century is not; BUT; every fourth century *is* a leap year. We've got two levels of override here.
