RosettaCodeData/Task/Long-year/XPL0/long-year.xpl0
2023-07-01 13:44:08 -04:00

24 lines
554 B
Text

\Long year
code Rem=2, CrLf=9, IntIn=10, IntOut=11, Text=12, Clear=40;
integer S, E, Y;
function integer Weekday(Y);
\Weekday of Y-12-31, 0 Sunday
integer Y;
return Rem((Y + Y / 4 - Y / 100 + Y / 400) / 7);
function integer IsLongYear(Y);
integer Y;
return 4 = Weekday(Y) ! 3 = Weekday(Y - 1);
begin
Clear;
Text(0, "**** List of ISO long years ****");
CrLf(0);
Text(0, "Start year: "); S:= IntIn(0);
Text(0, "End year: "); E:= IntIn(0);
CrLf(0);
for Y:= S, E do
if IsLongYear(Y) then [IntOut(0, Y); Text(0, " ")];
CrLf(0);
end