Day of the week: Difference between revisions
Content added Content deleted
m (→{{header|AppleScript}}: (light refactor)) |
m (→{{header|BASIC}}: corrected formatting error, I hope) |
||
Line 689: | Line 689: | ||
AUTO 100,10 |
AUTO 100,10 |
||
DEFine PROC Iso(S,O) |
|||
REM |
REM inputting starting & ending years as integers S and O |
||
LOCal y$,m%,d%,i$,n%,w% |
LOCal y$,m%,d%,i$,n%,w% |
||
LET m%=12 : d%=25 |
LET m%=12 : d%=25 |
||
REM |
REM as m% & d% are constants, avoid recalculating n% (=48) each iteration |
||
LET i$=m%*256+ 19300 : n%=i$(2TO 3)+ d% |
LET i$=m%*256+ 19300 : n%=i$(2TO 3)+ d% |
||
REM |
REM skipping unnecessary years below |
||
FOR count=S TO O |
FOR count=S TO O |
||
LET y$=count : w%=(y$(1TO 2)&"32"DIV 16+ count DIV 4+ count+ n%)MOD 7 |
LET y$=count : w%=(y$(1TO 2)&"32"DIV 16+ count DIV 4+ count+ n%)MOD 7 |
||
REM or |
REM or by using w%=(y$(1TO 2)&"16"DIV 16+ count DIV 4+ count)MOD 7 as further optimisation |
||
IF w%=0 THEN PRINT count : count = count+ 4 |
IF w%=0 THEN PRINT count : count = count+ 4 |
||
END FOR count |
END FOR count |
||
END DEFine |
|||
{{keypress|ctrl|space}} |
{{keypress|ctrl|space}} |
||
</lang> |
|||
=={{header|Batch File}}== |
=={{header|Batch File}}== |
||
<lang dos> |
<lang dos> |
||
:: Day of the Week task from Rosetta Code |
:: Day of the Week task from Rosetta Code Simi |
||
:: Batch File Implementation |
:: Batch File Implementation |
||
:: |
:: |