Day of the week: Difference between revisions
Content added Content deleted
m (→{{header|Forth}}: just try 1 jan 2012, which should be a sunday... obviously not enough to just do a (month+9) mod 12 in zeller word : january must be 13 and february 14) |
(Added 4tH version) |
||
Line 619: | Line 619: | ||
cr yuletide |
cr yuletide |
||
December 25 is Sunday in 2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2100 2106 2117</lang> |
December 25 is Sunday in 2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2100 2106 2117</lang> |
||
In [[4tH]] a library is available which provides the right answer: |
|||
<lang forth>include lib/time.4th |
|||
: yuletide |
|||
." December 25 is Sunday in " |
|||
2122 2008 do |
|||
25 12 i weekday |
|||
6 = if i . then |
|||
loop cr ; |
|||
cr yuletide</lang> |
|||
The code is derived from "Collected Algorithms from ACM", Volume 1 Algorithms 1-220. |
|||
=={{header|Fortran}}== |
=={{header|Fortran}}== |