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.




PROC Nth(CARD val,CHAR ARRAY s)
  CHAR ARRAY sfx
  BYTE d
 
  StrC(val,s)
  s(0)=s(0)+1
  s(s(0))=''
 
  d=val MOD 100
  IF d>10 AND d<14 THEN
    sfx="th"
  ELSE
    d=val MOD 10
    IF d=1 THEN sfx="st"
    ELSEIF d=2 THEN sfx="nd"
    ELSEIF d=3 THEN sfx="rd"
    ELSE sfx="th"
    FI
  FI
 
  s(0)=s(0)+2
  SAssign(s,sfx,s(0)-1,s(0)+1)
RETURN
 
PROC Main()
  CARD ARRAY n=[0 250 1000]
  CHAR ARRAY s(10)
  CARD i,j
 
  FOR i=0 TO 2
  DO
    FOR j=n(i) TO n(i)+25
    DO
      Nth(j,s)
      PrintF("%S ",s)
    OD
    PutE() PutE()
  OD
RETURN