Leap Year Checker.

Paul John Falstad pfalstad at phoenix.Princeton.EDU
Sun Sep 23 11:13:29 AEST 1990


In article <24700010 at sunc1> mccaugh at sunc1.cs.uiuc.edu writes:
> Ordinarily, a leap-year is a multiple of four, so thst -- given leap-year y --
> (y%4 == 0) ought to indicate if y designates a leap-year.

Except for century years.  Only century years divisible by 400 are
leap years.  The correct formula is:

(!(y % 4) && (y % 100 || !(y % 400)))

Sorry to split hairs, but this IS usenet, after all.

                This is the silliest sketch I've ever been in!



More information about the Comp.lang.c mailing list