Jump to content

Day of the week: Difference between revisions

→‎{{header|Atari BASIC}}: Add implementation
m (→‎{{header|Commodore BASIC}}: Remove unused leap-year function)
(→‎{{header|Atari BASIC}}: Add implementation)
Line 506:
 
=={{header|BASIC}}==
 
<b>Works with:</b> FreeBASIC <br>
This program needs the modulo function because there is a bug in the built in modulo function.
Line 554 ⟶ 555:
Dec 25, 2112
Dec 25, 2118</lang>
 
==={{header|Atari BASIC}}===
{{trans|Commodore BASIC}}
<lang basic>100 REM FIND YEARS WITH SUNDAY CHRISTMAS
110 PRINT CHR$(125);"SUNDAY CHRISTMASES 2008-2121:":PRINT
120 FOR Y=2008 TO 2121
130 EOY=Y*365+INT(Y/4)-INT(Y/100)+INT(Y/400)
140 XMAS=EOY-6
150 DOW=XMAS-7*INT(XMAS/7)
160 IF DOW THEN 220
170 PRINT Y;
180 FOUND=FOUND+1
190 IF FOUND<3 THEN PRINT ,:GOTO 220
200 FOUND=0
210 PRINT
220 NEXT Y
230 IF FOUND THEN PRINT</lang>
 
{{Out}}
<pre> SUNDAY CHRISTMASES 2008-2121
 
2011 2016 2022
2033 2039 2044
2050 2061 2067
2072 2078 2089
2095 2101 2107
2112 2118</pre>
 
==={{header|BaCon}}===
Line 599 ⟶ 627:
200 DEF FNXS(Y) = FND7(FNRD(Y) - 6):REM 6 DAYS BEFORE THE END OF THE YEAR
210 REM TRY OUR TARGET YEARS AND OUTPUT THE ONES THAT MATCH
220 PRINT "THESUNDAY FOLLOWINGCHRISTMASES YEARS HAVE CHRISTMAS ON A SUNDAY2008-2121:";CHR$(13)
230 FOR Y=2008 TO 2121
240 : IF FNXS(Y) THEN PRINT Y,:REM PRINT YEARS IN COLUMNS
Line 606 ⟶ 634:
 
{{Out}}
<pre>SUNDAY CHRISTMASES 2008-2121:
<pre>RUN
 
THE FOLLOWING YEARS HAVE CHRISTMAS ON A
SUNDAY:
2011 2016 2022 2033
2039 2044 2050 2061
2067 2072 2078 2089
2095 2101 2107 2112
2118</pre>
 
READY.
</pre>
 
==={{header|FreeBASIC}}===
1,481

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.