Five weekends: Difference between revisions

Line 2,022:
Oct2100 has 5 weekends
Total number of months having 3-day weekends = 201
</pre>
 
Part 2: Years not having any month of 5 weekends:
<pre>
weekends: procedure options (main);
declare tally fixed initial (0);
declare (d, dend, dn) fixed (10);
declare (date_start, date_end) picture '99999999';
declare Leap fixed (1);
declare Long_weekend bit (1);
 
date_start = '01011900';
do date_start = date_start to '01012100';
d = days(date_start, 'DDMMYYYY');
date_end = date_start + 30110000;
dend = days(date_end, 'DDMMYYYY');
Leap = dend-d-364;
long_weekend = '0'b;
do dn = d, d+59+Leap, d+120+Leap, d+181+Leap, d+212+Leap,
d+273+Leap, d+334+Leap;
if weekday(dn) = 6 then long_weekend = '1'b;
end;
if ^long_weekend then
put skip list (daystodate(dn, 'YYYY') || ' has no month of 5 weekends');
end;
 
end weekends;
</pre>
OUTPUT:
<pre>
1900 has no month of 5 weekends
1906 has no month of 5 weekends
1917 has no month of 5 weekends
1923 has no month of 5 weekends
1928 has no month of 5 weekends
1934 has no month of 5 weekends
1945 has no month of 5 weekends
1951 has no month of 5 weekends
1956 has no month of 5 weekends
1962 has no month of 5 weekends
1973 has no month of 5 weekends
1979 has no month of 5 weekends
1984 has no month of 5 weekends
1990 has no month of 5 weekends
2001 has no month of 5 weekends
2007 has no month of 5 weekends
2012 has no month of 5 weekends
2018 has no month of 5 weekends
2029 has no month of 5 weekends
2035 has no month of 5 weekends
2040 has no month of 5 weekends
2046 has no month of 5 weekends
2057 has no month of 5 weekends
2063 has no month of 5 weekends
2068 has no month of 5 weekends
2074 has no month of 5 weekends
2085 has no month of 5 weekends
2091 has no month of 5 weekends
2096 has no month of 5 weekends
</pre>
 
Anonymous user