Five weekends: Difference between revisions

added Arturo
m (→‎{{header|RPL}}: typo in comment)
(added Arturo)
Line 931:
1984, 1990, 2001, 2007, 2012, 2018, 2029, 2035, 2040, 2046, 2057, 2063, 2068, 2074,
2085, 2091, 2096}}}</syntaxhighlight>
 
=={{header|Arturo}}==
<syntaxhighlight lang="arturo">longMonths: [1 3 5 7 8 10 12]
dates: []
 
yearsWithout: 0
 
loop 1900..2100 'year [
found?: false
loop longMonths 'month [
dt: to :date .format:"d-M-YYYY" ~"1-|month|-|year|"
if friday? dt [
'dates ++ @[@[dt\Month year]]
found?: true
]
]
if not? found? ->
inc 'yearsWithout
]
 
print.lines map first.n:5 dates 'd -> ~"|to :string d\0|, |to :string d\1|"
print "..."
print.lines map last.n:5 dates 'd -> ~"|to :string d\0|, |to :string d\1|"
 
print ""
print ["Found" size dates "months in total."]
print ["There are" yearsWithout "years without any month that has 5 full weekends."]</syntaxhighlight>
 
{{out}}
 
<pre>March, 1901
August, 1902
May, 1903
January, 1904
July, 1904
...
March, 2097
August, 2098
May, 2099
January, 2100
October, 2100
 
Found 201 months in total.
There are 29 years without any month that has 5 full weekends.</pre>
 
=={{header|AutoHotkey}}==
1,532

edits