REM
REM Demo implementing Zeller's Congruence
REM http://en.wikipedia.org/wiki/Zeller_congruence
REM
REM March 2009 - PvE.
REM Revised december 2009.
REM Revised may 2010.
INPUT "Enter day of the month (1-31): ", q
IF q > 31 OR q < 1 THEN
PRINT "Day must be within 1-31!"
END
ENDIF
INPUT "Enter month (1-12): ", m
IF m > 12 OR m < 1 THEN
PRINT "Month must be within 1-12!"
END
ENDIF
INPUT "Enter year: ", year$
REM the LET statement is optional
LET J = VAL(LEFT$(year$, 2))
LET K = VAL(MID$(year$, 3, 2))
IF m EQ 1 OR m EQ 2 THEN
INCR m, 12
DECR K
ENDIF
REM Here the LET is omitted
h = (q + ((m+1)*26)/10 + K + (K/4) + (J/4) + 5*J)
day = MOD(h, 7)
SELECT day
CASE 0
PRINT "That is a Saturday."
CASE 1
PRINT "That is a Sunday."
CASE 2
PRINT "That is a Monday."
CASE 3
PRINT "That is a Tuesday."
CASE 4
PRINT "That is a Wednesday."
CASE 5
PRINT "That is a Thursday."
CASE 6
PRINT "That is a Friday."
END SELECT