Day of the week: Difference between revisions
Content added Content deleted
(→{{header|ASIC}}: Added a solution.) |
(→{{header|PL/0}}: Added a solution.) |
||
Line 4,262: | Line 4,262: | ||
"2118" |
"2118" |
||
}) |
}) |
||
</pre> |
|||
=={{header|PL/0}}== |
|||
{{trans|GW-BASIC}} |
|||
<syntaxhighlight lang="pascal"> |
|||
var year, month, day, dayofweek; |
|||
procedure calcdayofweek; |
|||
begin |
|||
if month < 3 then |
|||
begin |
|||
year := year - 1; |
|||
month := month + 12 |
|||
end; |
|||
dayofweek := year + year / 4 - year / 100 + year / 400; |
|||
dayofweek := dayofweek + day + (153 * month + 8) / 5; |
|||
dayofweek := dayofweek - (dayofweek / 7) * 7 |
|||
end; |
|||
begin |
|||
month := 12; day := 25; |
|||
year := 2007; |
|||
while year <= 2122 do |
|||
begin |
|||
call calcdayofweek; |
|||
if dayofweek = 0 then ! year; |
|||
year := year + 1 |
|||
end |
|||
end. |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
2011 |
|||
2016 |
|||
2022 |
|||
2033 |
|||
2039 |
|||
2044 |
|||
2050 |
|||
2061 |
|||
2067 |
|||
2072 |
|||
2078 |
|||
2089 |
|||
2095 |
|||
2101 |
|||
2107 |
|||
2112 |
|||
2118 |
|||
</pre> |
</pre> |
||