10 PRINT "DAY BETWEEN TWO DATES"
20 PRINT
25 PRINT "USE MM,DD,YYYY"
29 REM - STATEMENTS 30 TO 60 REQUEST USER INPUT
30 PRINT "FIRST DATE";
40 INPUT M1,D1,Y1
50 PRINT "SECOND DATE";
60 INPUT M2,D2,Y2
69 REM - SET VARIABLES TO BE USED IN SUBROUTINE
70 M=M1
80 D=D1
90 Y=Y1
100 GOSUB 230
109 REM - SAVE COMPUTED NUMBER OF DAYS IN N
110 N=A
119 REM - SET VARIABLES TO BE USED IN SUBROUTINE
120 M=M2
130 D=D2
140 Y=Y2
150 GOSUB 230
159 REM - CALCULATE DIFFERENCE AND PRINT
160 N=A-N
170 PRINT "DIFFERENCE =";N;"DAYS"
180 PRINT
189 REM - RESTART OR END PROGRAM?
190 PRINT "MORE DATA (1=YES, 0=NO)";
200 INPUT X
210 IF X=1 THEN 20
219 REM - END PROGRAM
220 GOTO 460
227 REM - SUBROUTINE TO COMPUTE NUMBER OF DAYS SINCE 0,0,0 TO M,D,Y
228 REM - START WITH TEST FOR UNREAL DATE
229 REM - GO TO CORRECT TEST DEPENDING ON NUMBER OF DAYS IN MONTH
230 ON M GOTO 260,280,260,340,260,340,260,260,340,260,340,260
239 REM - IF THIS MESSAGE IS PRINTED THE ANSWER IS PROBABLY INCORRECT
240 PRINT "UNREAL DATE"
249 REM - STOP CALCULATIONS, RETURN TO MAIN PROGRAM
250 RETURN
259 REM - MONTH HAS 31 DAYS
260 IF D>31 THEN 240
270 GOTO 350
279 REM - MONTH IS FEBRUARY; A LEAP YEAR?
280 IF Y/4=INT(Y/4) THEN 290
290 IF Y/400=INT(Y/400) THEN 320
300 IF Y/100=INT(Y/100) THEN 310
309 REM - NOT A LEAP YEAR; MONTH HAS 28 DAYS
310 IF D>28 THEN 240
319 REM - A LEAP YEAR; MONTH HAS 29 DAYS
320 IF D>29 THEN 240
330 GOTO 350
339 REM - MONTH HAS 30 DAYS
340 IF D>30 THEN 240
349 REM - TABLE OF NUMBER OF DAYS FROM 1ST OF YEAR TO 1ST OF EACH MONTH
350 DATA 0,31,59,90,120,151,181,212,243,273,304,334
360 RESTORE 
369 REM - GET NUMBER OF DAYS FROM JAN 1 TO 1ST OF MONTH FROM DATA TABLE
370 READ A
379 REM - COMPUTE NUMBER OF DAYS FROM 0,0,0 TO M,D,Y
380 A=A+Y*365+INT(Y/4)+D+1-INT(Y/100)+INT(Y/400)
389 REM - POSSIBLY A LEAP YEAR?
390 IF INT(Y/4)=Y/4 THEN 410
400 GOTO 450
409 REM - CONTINUE TEST FOR LEAP YEAR
410 IF Y/400=INT(Y/400) THEN 430
420 IF Y/100=INT(Y/100) THEN 440
428 REM - YEAR IS A LEAP YEAR;
429 REM - IF MONTH IS JAN OR FEB ADJUST CALCULATED NUMBER OF DAYS
430 IF M>2 THEN 450
440 A=A-1
449 REM - END OF SUBROUTINE, RETURN TO MAIN PROGRAM
450 RETURN
460 END
