home bbs files messages ]

Just a sample of the Echomail archive

<< oldest | < older | list | newer > | newest >> ]

 Message 75 
 mark lewis to Paul Quinn 
 another convoluted brainteaser for the g 
 08 Feb 12 14:49:23 
 
 ml> this is why i need to take a sec later on and look at the real 
 ml> formula... then you can have an array with all of the month days 
 ml> count and automatically adjust FEB when it has 29 days ;)

 PQ> How about a bit of something in some old Turbo-C...

pretty neat... but it looks like it is missing something...

function leapyear( year : integer) : boolean;
{ Returns true if YEAR is a leaplear
    A year is a leap year if it is evenly divisible 
    by 4 except :
      if it is divisible by 100 then :
        it is NOT a leap year unless it is divisible 
        by 400 but not 4000

    Thus 2000 (divisible by 400 but not by 4000) is a leap year
    but 4000 (divisible by 4000) is NOT a leap year.
  Reference : Introductory Astronomy and Astrophysics, page 61
  By E. v. P. Smith and K. C. Jacobs - (C) 1973 W. B. Saunders Co.}

{ By Jud McCranie, Jan. 4, 1987 }
{ Revised Jan. 5, 1987          }

begin
leapyear := (year mod 4 = 0);

if year mod 100 = 0
  then leapyear := (year mod 400 = 0) and (year mod 4000 > 0);

end; {*** leap year ***}


)\/(ark

 * Origin:  (1:3634/12)

<< oldest | < older | list | newer > | newest >> ]

(c) 1994,  bbs@darkrealms.ca