Long year: Difference between revisions

→‎{{header|Forth}}: simplify - for weekday we don't need to multiply by 365, since that's congruent to 1 mod 7.
(→‎{{header|Forth}}: Add implementation)
(→‎{{header|Forth}}: simplify - for weekday we don't need to multiply by 365, since that's congruent to 1 mod 7.)
Line 751:
 
=={{header|Forth}}==
<lang forth>: dec31wd dup 365 * swap dup 4 / swap dup 100 / swap 400 / swap - + + 7 mod ;
: long dup dec31wd 4 = if drop 1 else 1 - dec31wd 3 = if 1 else 0 then then ;
: demo 2045 1995 do i long if i . then loop ;</lang>
Line 757:
{{Out}}
<pre>demo 1998 2004 2009 2015 2020 2026 2032 2037 2043 ok</pre>
 
 
=={{header|Fortran}}==
1,480

edits