Day of the week: Difference between revisions
no edit summary
(→{{header|Swift}}: Update for Yosemite) |
Simple9371 (talk | contribs) No edit summary |
||
Line 219:
Dec 25, 2112
Dec 25, 2118</lang>
=={{header|Batch File}}==
<lang dos>
:: Day of the Week task from Rosetta Code Wiki
:: Batch File Implementation
::
:: In what years between 2008 and 2121 will the 25th of December be a Sunday?
::
:: This implementation uses Zeller's Rule...
@echo off
::Set month code for December
set mon=33
::Set day number
set day=25
for /L %%w in (2008,1,2121) do (
call :check_day %%w
)
exit /b
:check_day
set yr=%1
set /a a=%yr%/100
set /a b=%yr%-(%a%*100)
set /a weekday=(%day%+%mon%+%b%+(%b%/4)+(%a%/4)+(5*%a%))%%7
if %weekday%==1 (
echo Dec 25, %yr% is a Sunday.
)
goto :EOF
</lang>
{{out}}
<pre>
Dec 25, 2011 is a Sunday.
Dec 25, 2016 is a Sunday.
Dec 25, 2022 is a Sunday.
Dec 25, 2033 is a Sunday.
Dec 25, 2039 is a Sunday.
Dec 25, 2044 is a Sunday.
Dec 25, 2050 is a Sunday.
Dec 25, 2061 is a Sunday.
Dec 25, 2067 is a Sunday.
Dec 25, 2072 is a Sunday.
Dec 25, 2078 is a Sunday.
Dec 25, 2089 is a Sunday.
Dec 25, 2095 is a Sunday.
Dec 25, 2101 is a Sunday.
Dec 25, 2107 is a Sunday.
Dec 25, 2112 is a Sunday.
Dec 25, 2118 is a Sunday.
</pre>
=={{header|BBC BASIC}}==
|