Re: 28 or 29 days?
> Hi all,
>
> I need URGENTLY an algorithm to see is a given year is a leap year.
> Can any of you help me? I bet that in some old book it appears ;)
Here's a short routine that'll do that:
function leap_year (integer year)
-- Returns true if year is a leap year, otherwise false.
if year<1582 then
if remainder(year,4)=0 then
return 1
else
return 0
end if
else
if remainder(year,400)=0 then
return 1
elsif remainder(year,100)=0 then
return 0
elsif remainder(year,4)=0 then
return 1
else
return 0
end if
end if
end function
Regards,
Michael Bolin
|
Not Categorized, Please Help
|
|