Doomsday rule: Difference between revisions
Content added Content deleted
(added Perl programming solution) |
m (→{{header|REXX}}: simplified some code.) |
||
Line 895: | Line 895: | ||
y.1= 4 1 7 4 2 6 4 1 5 3 7 5 /* " " " leapyear " */ |
y.1= 4 1 7 4 2 6 4 1 5 3 7 5 /* " " " leapyear " */ |
||
do j=1 for words($) |
do j=1 for words($); datum= word($, j) /*process each of the dates. */ |
||
parse |
parse var datum mm '/' dd "/" yy /*parse the date ──► mm dd yy */ |
||
ly= leapyear(yy) |
ly= leapyear(yy) /*get indication of a leapyear. */ |
||
wd= (doomsday(yy)+dd-word(y.ly, mm) + 7) // 7 + 1 |
wd= (doomsday(yy)+dd-word(y.ly, mm) + 7) // 7 + 1 /*obtain a code for the weekday.*/ |
||
say |
say datum ' falls on ' word(d, wd)"day" /*display day-of-week for date. */ |
||
end /*j*/ |
end /*j*/ |
||
exit 0 /*stick a fork in it, we're all done. */ |
exit 0 /*stick a fork in it, we're all done. */ |