RosettaCodeData/Task/Nth/Maple/nth.maple

26 lines
443 B
Plaintext

toOrdinal := proc(n:: nonnegint)
if 1 <= n and n <= 10 then
if n >= 4 then
printf("%ath", n);
elif n = 3 then
printf("%ard", n);
elif n = 2 then
printf("%and", n);
else
printf("%ast", n);
end if:
else
printf(convert(n, 'ordinal'));
end if:
return NULL;
end proc:
a := [[0, 25], [250, 265], [1000, 1025]]:
for i in a do
for j from i[1] to i[2] do
toOrdinal(j);
printf(" ");
end do;
printf("\n\n");
end do;