Path: utzoo!attcan!uunet!wuarchive!usc!jarthur!nntp-server.caltech.edu!manning From: manning@nntp-server.caltech.edu (Evan Marshall Manning) Newsgroups: comp.lang.c Subject: Re: Leap Year Checker...even more to it Message-ID: <1990Sep30.221335.20290@nntp-server.caltech.edu> Date: 30 Sep 90 22:13:35 GMT References: <1115.26ff47b6@iccgcc.decnet.ab.com> <242@srchtec.UUCP> <4404@catfish11.UUCP> <1990Sep30.013852.8764@murdoch.acc.Virginia.EDU> Organization: California Institute of Technology, Pasadena Lines: 21 cak3g@astsun9.astro.Virginia.EDU (Colin Klipsch) writes: >int is_leap_year(int year) >{ > if (year%4000 == 0) return FALSE; > else if (year%400 == 0) return TRUE; > else if (year%100 == 0) return FALSE; > else if (year%4 == 0) return TRUE; > else return FALSE; >} All other things being equal, I've got to vote for the versions that make the tests most likely to be decisive first. Years like 1990 will have to undergo all of the tests above. *************************************************************************** Your eyes are weary from staring at the CRT for so | Evan M. Manning long. You feel sleepy. Notice how restful it is | is to watch the cursor blink. Close your eyes. The |manning@gap.cco.caltech.edu opinions stated above are yours. You cannot | manning@mars.jpl.nasa.gov imagine why you ever felt otherwise. | gleeper@tybalt.caltech.edu