N'th: Difference between revisions

1,167 bytes added ,  2 years ago
Line 3,997:
((1000 TH) (1001 ST) (1002 ND) (1003 RD) (1004 TH) (1005 TH) (1006 TH) (1007 TH) (1008 TH) (1009 TH) (1010 TH) (1011 TH) (1012 TH) (1013 TH) (1014 TH) (1015 TH) (1016 TH) (1017 TH) (1018 TH) (1019 TH) (1020 TH) (1021 ST) (1022 ND) (1023 RD) (1024 TH) (1025 TH))</pre>
 
=={{header|XPL0}}==
{{trans|Ada}}
{{works with|EXPL-32}}
<lang xpl0>
\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
</lang>
{{out}}
<pre>
0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th
250th 251st 252nd 253rd 254th 255th 256th 257th 258th 259th 260th 261st 262nd 263rd 264th 265th
1000th 1001st 1002nd 1003rd 1004th 1005th 1006th 1007th 1008th 1009th 1010th 1011th 1012th 1013th 1014th 1015th 1016th 1017th 1018th 1019th 1020th 1021st 1022nd 1023rd 1024th 1025th
</pre>
 
=={{header|Yabasic}}==
Anonymous user