Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Five-weekends/PL-I/five-weekends.pli
Normal file
25
Task/Five-weekends/PL-I/five-weekends.pli
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
weekends: procedure options (main); /* 28/11/2011 */
|
||||
declare tally fixed initial (0);
|
||||
declare (d, dend, dn) fixed (10);
|
||||
declare (date_start, date_end) picture '99999999';
|
||||
declare Leap fixed (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;
|
||||
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
|
||||
do;
|
||||
put skip list (daystodate(dn, 'MmmYYYY') || ' has 5 weekends' );
|
||||
tally = tally + 1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
put skip list ('Total number of months having 3-day weekends =', tally);
|
||||
|
||||
end weekends;
|
||||
Loading…
Add table
Add a link
Reference in a new issue