RosettaCodeData/Task/Nth/XPL0/nth.xpl0
2023-07-01 13:44:08 -04:00

36 lines
665 B
Text

\N'th
code Rem=2, CrLf=9, IntIn=10, IntOut=11, Text=12;
procedure Suf(N, S);
integer N;
character S;
integer NMod10, NMod100;
begin
NMod10:= Rem(N/10);
NMod100:= Rem(N/100);
case of
NMod10 = 1 & NMod100 # 11: S(0):= "st";
NMod10 = 2 & NMod100 # 12: S(0):= "nd";
NMod10 = 3 & NMod100 # 13: S(0):= "rd"
other
S(0):= "th";
end;
procedure PrintImages(LoLim, HiLim);
integer LoLim, HiLim;
integer I;
character S;
begin
for I:= LoLim, HiLim do
begin
Suf(I, addr S);
IntOut(0, I); Text(0, S); Text(0, " ")
end;
CrLf(0)
end;
begin
PrintImages(0, 25);
PrintImages(250, 265);
PrintImages(1000, 1025)
end