10 REM CALENDAR.BAS - LAST EDITTED 31/01/82
20 REM Dr Dobbs Nov 1981 p61
30 REM This program inputs a month and year and
40 REM from that prints the current months calendar.
50 REM
60 DEFINT A-Y
70 DEFSTR Z
80 INPUT "Month";M
90 INPUT "Year";Y
100 IF Y<1900 OR Y > 2099 THEN PRINT "Between 1900 and 2099 please!" : GOTO 80
110 IF M <1 OR M > 12 GOTO 80
120 MONTH = M : YEAR = Y : GOSUB 320
130 DAY = D : YEAR = Y : MONTH = M+1
140 IF MONTH < 13 GOTO 160 ELSE MONTH = 1
150 YEAR = YEAR +1
160 GOSUB 320
170 D=28+D-DAY
180 IF D<28 THEN D = D+7
190 FOR I=1 TO M
200 READ ZMONTH
210 NEXT
220 PRINT " ";ZMONTH; TAB(25);
230 PRINT USING "####";Y
240 PRINT " Sun Mon Tue Wed Thu Fri Sat"
250 PRINT TAB(DAY*4+1);
260 FOR I=1 TO D
270 PRINT USING " ##";I;
280 IF (I+DAY) MOD 7 = 0 AND I < D THEN PRINT
290 NEXT
300 PRINT
310 END
320 REM Comput the day of the week
330 MONTH = MONTH -2
340 IF MONTH > 0 GOTO 360 ELSE MONTH = MONTH + 12
350 YEAR = YEAR - 1
360 CENTURY = YEAR\100
370 YEAR = YEAR MOD 100
380 D= ((13*MONTH - 1)\ 5 + 5 * YEAR\4 + CENTURY\4 - 2 * CENTURY +1) MOD 7
390 RETURN
400 DATA January,February,March,April,May,June,July,August,September
410 DATA October,November,December
) MOD 7
390 RETURN
400 DATA January,February,March,A