Day of the week: Difference between revisions
→{{header|Batch File}}: shortened code (this section is among my first contributions here huhuhu)
(Added Algol W) |
Simple9371 (talk | contribs) (→{{header|Batch File}}: shortened code (this section is among my first contributions here huhuhu)) |
||
Line 754:
=={{header|Batch File}}==
▲:: Day of the Week task from Rosetta Code Simi
:: Batch File Implementation
:: Question: In what years between 2008 and 2121 will the 25th of December be a Sunday?▼
:: Method: Zeller's Rule
▲:: In what years between 2008 and 2121 will the 25th of December be a Sunday?
@echo off
▲::Set month code for December
set mon=33
▲::Set day number
set day=25
for /L %%
setlocal enabledelayedexpansion
pause>nul▼
endlocal
▲set /a a=%yr%/100
▲set /a b=%yr%-(%a%*100)
▲set /a weekday=(%day%+%mon%+%b%+(%b%/4)+(%a%/4)+(5*%a%))%%7
▲echo Dec 25, %yr% is a Sunday.
)
exit /b 0</lang>
{{out}}
<pre>Dec 25, 2011 is a Sunday.▼
▲Dec 25, 2011 is a Sunday.
Dec 25, 2016 is a Sunday.
Dec 25, 2022 is a Sunday.
Line 806 ⟶ 793:
Dec 25, 2112 is a Sunday.
Dec 25, 2118 is a Sunday.
Press any key to continue . . .</pre>
=={{header|BBC BASIC}}==
|