Write a function/method/subroutine/... that when given an integer greater than or equal to zero returns a string of the number followed by an apostrophe then the ordinal suffix.



Example

Returns would include 1'st 2'nd 3'rd 11'th 111'th 1001'st 1012'th



Task

Use your routine to show here the output for at least the following (inclusive) ranges of integer inputs:
0..25, 250..265, 1000..1025


Note: apostrophes are now optional to allow correct apostrophe-less English.




 
sub ordinal$ (n)
    NMod10 = mod(n, 10)
    NMod100 = mod(n, 100)
    if (NMod10 = 1) and (NMod100 <> 11) then
       return "st"
    else
       if (NMod10 = 2) and (NMod100 <> 12) then
          return "nd"
       else
          if (NMod10 = 3) and (NMod100 <> 13) then
             return "rd"
          else
             return "th"
          end if
       end if
    end if
end sub
 
sub imprimeOrdinal(a, b)
    for i = a to b
        print i, ordinal$(i), " ";
    next i
    print
end sub
 
imprimeOrdinal (0, 25)
imprimeOrdinal (250, 265)
imprimeOrdinal (1000, 1025)
end
 