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.




nth = proc (n: int) returns (string)
    num: string := int$unparse(n)
    sfx: array[string] := array[string]$[0: "th", "st", "nd", "rd"]
 
    if n / 10 // 10 = 1 cor n // 10 > 3 then
        return(num || sfx[0])
    else
        return(num || sfx[n // 10])
    end
end nth
 
do_range = proc (from, to: int)
    po: stream := stream$primary_output()
    col: int := 0
 
    for i: int in int$from_to(from,to) do
        stream$putleft(po, nth(i), 7)
        col := col + 1
        if col = 10 then
            stream$putc(po, '\n')
            col := 0
        end
    end
    stream$putl(po, "\n")
end do_range 
 
start_up = proc ()
    do_range(0,25)
    do_range(250,265)
    do_range(1000,1025)
end start_up