Day of the week: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add Draco) |
Not a robot (talk | contribs) (Add CLU) |
||
Line 1,233: | Line 1,233: | ||
</lang> |
</lang> |
||
<pre>(2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118)</pre> |
<pre>(2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118)</pre> |
||
=={{header|CLU}}== |
|||
<lang clu>weekday = proc (d: date) returns (int) |
|||
y: int := d.year |
|||
m: int := d.month |
|||
if m<3 |
|||
then y, m := y-1, m+10 |
|||
else m := m-2 |
|||
end |
|||
c: int := y/100 |
|||
y := y//100 |
|||
z: int := (26*m-2)/10 + d.day + y + y/4 + c/4 - 2*c + 777 |
|||
return(z//7) |
|||
end weekday |
|||
start_up = proc () |
|||
po: stream := stream$primary_output() |
|||
for year: int in int$from_to(2008, 2121) do |
|||
if weekday(date$create(25, 12, year, 0, 0, 0))=0 then |
|||
stream$putl(po, int$unparse(year)) |
|||
end |
|||
end |
|||
end start_up</lang> |
|||
{{out}} |
|||
<pre>2011 |
|||
2016 |
|||
2022 |
|||
2033 |
|||
2039 |
|||
2044 |
|||
2050 |
|||
2061 |
|||
2067 |
|||
2072 |
|||
2078 |
|||
2089 |
|||
2095 |
|||
2101 |
|||
2107 |
|||
2112 |
|||
2118</pre> |
|||
=={{header|COBOL}}== |
=={{header|COBOL}}== |