Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!uupsi!sunic!cs.umu.se!dvlhma From: dvlhma@cs.umu.se (Henrik Magnusson) Newsgroups: comp.lang.pascal Subject: Re: Leap year function Message-ID: <1991May16.211220.27240@cs.umu.se> Date: 16 May 91 21:12:20 GMT References: <26912@adm.brl.mil> Sender: news@cs.umu.se (News Administrator) Organization: Dep. of Info.Proc, Umea Univ., Sweden Lines: 27 In article <26912@adm.brl.mil> bakerre@tawc1.eglin.af.mil (Baker, Robert E.) writes: > > I'm looking for source for a function that determines whether or not a >year is a leap year. Anybody got it. ADVthanksANCE. > To determine if a year is a leap year or not is pretty easy. If the year is not a hundred (1988, 1989, 1990) then the year should be divisable with 4 to be a leapyear. If the year is a hundred (1800, 1900, 2000) then the year should be divisable with 400. Here is a quickly written function. FUNCTION is_leap_yeat(year :integer) :Boolean; BEGIN is_leap_year := ((year MOD 4) AND NOT (year mod 100)) OR (year MOD 400); END; /NeNNe ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Henrik Magnusson :: "How'd you puncture that tyre?" :: :: dvlhma@cs.umu.se :: "Ran over a milk bottle" :: :: :: "Didn't you see it?" :: :: Umeaa University, Sweden :: "Damn kid had it under his coat." :: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::