Five weekends: Difference between revisions

Updated to work with version 1.4 of Nim.
m (→‎{{header|Phix}}: use a more explicit test for "Friday")
(Updated to work with version 1.4 of Nim.)
Line 4,583:
 
const LongMonths = {mJan, mMar, mMay, mJul, mAug, mOct, mDec}
 
var timeinfo = getLocalTime getTime()
timeinfo.monthday = 1
 
var sumNone = 0
Line 4,591 ⟶ 4,588:
var none = true
for month in LongMonths:
if initDateTime(1, month, year, 0, 0, 0).weekday == dFri:
timeinfo.year = year
timeinfo.month = echo month, " ", year
if getLocalTime(timeInfoToTime timeinfo).weekday == dFri:
echo month," ",year
none = false
if none: inc sumNone
 
echo "Years\nYears without a 5 weekend month: ", sumNone</lang>
{{out}}
<pre>March 1901
Line 4,611 ⟶ 4,607:
January 2100
October 2100
 
Years without a 5 weekend month: 29</pre>
 
Anonymous user