Five weekends: Difference between revisions

Line 6:
# Show the ''number'' of months with this property.
# Show at least the first and last five dates, in order.
 
=={{header|J}}==
<lang j>require 'types/datetime'
find5wkdMonths=: verb define
years=. 1900 + i. >: 1900 -~ 2100
months=. 1 3 5 7 8 10 12
dates=. 31
(#~ 0 = weekday) >,{years;months;date
)</lang>
'''Usage:'''
<lang j> # find5wkdMonths '' NB. number of months found
201
>'MMM YYYY' fmtDate toDayNo (5&{. , _5&{.) find5wkdMonths '' NB. First and last 5 months found
Mar 1901
Aug 1902
May 1903
Jan 1904
Jul 1904
Mar 2097
Aug 2098
May 2099
Jan 2100
Oct 2100</lang>
 
=={{header|Java}}==
892

edits