RosettaCodeData/Task/Five-weekends/Maple/five-weekends.maple

18 lines
577 B
Plaintext

five_weekends:= proc()
local i, month, count;
#Only months with 31 days can possibly satisfy the condition
local long_months := [1,3,5,7,8,10,12];
local months := ["January","February","March","April","May","June","July","August","September","October","November","December"];
count := 0;
for i from 1900 to 2100 by 1 do
for month in long_months do
if Calendar:-DayOfWeek(Date(i, month, 1)) = 6 then
printf("%d-%s\n", i, months[month]);
count++;
end if;
end do;
end do;
printf("%d months have five full weekends.\n", count);
end proc;
five_weekends();