Day of the week: Difference between revisions
Content added Content deleted
(→{{header|QL SuperBASIC}}: added output) |
|||
Line 696: | Line 696: | ||
REM as m% & d% are constants, avoid recalculating n% (=48) each iteration |
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% |
||
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 by using w%=(y$(1TO 2)&"16"DIV 16+ count DIV 4+ count)MOD 7 as |
REM or by using w%=(y$(1TO 2)&"16"DIV 16+ count DIV 4+ count)MOD 7 as |
||
REM further optimisation beyond skipping irrelevant years below |
REM further optimisation beyond skipping irrelevant years below |
||
IF w%=0 THEN PRINT count : count = count+ 4 |
IF w%=0 THEN PRINT count : count = count+ 4 |