プログラム例
LOGICAL FUNCTION LEAPYR(Y)
INTEGER Y
LEAPYR=.FALSE.
IF(MOD(Y,4).NE.0) RETURN
IF((MOD(Y,100).EQ.0).AND.(MOD(Y,400).NE.0)) RETURN
LEAPYR=.TRUE.
END
C====================================
C
C Which years are leap years?
C http://www.timeanddate.com/date/leapyear.html
C
C====================================
C
C In the Gregorian calendar, which is the calendar used by most modern
C countries, the following rules decides which years are leap years:
C
C 1. Every year divisible by 4 is a leap year.
C 2. But every year divisible by 100 is NOT a leap year
C 3. Unless the year is also divisible by 400, then it is still
C a leap year.
C
C This means that year 1800, 1900, 2100, 2200, 2300 and 2500 are **NOT**
C leap years, while year 2000 and 2400 are leap years.
C
C This actually means year 2000 is kind of special, as it is the first
C time the third rule is used in many parts of the world.
C
C In the old Julian Calendar, there was only one rule: Every year
C divisible by 4 is a leap year. This calendar was used before the
C Gregorian calendar was adopted.