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.




 
PROGRAM NTH_SOLVE
 
!
! for rosettacode.org
!
 
PROCEDURE NTH(S%,E%)
      LOCAL I%,SUFF$
      FOR I%=S% TO E% DO
        SUFF$="th"
        IF I% MOD 10=1 AND I% MOD 100<>11 THEN SUFF$="st" END IF
        IF I% MOD 10=2 AND I% MOD 100<>12 THEN SUFF$="nd" END IF
        IF I% MOD 10=3 AND I% MOD 100<>13 THEN SUFF$="rd" END IF
        PRINT(STR$(I%)+SUFF$+" ";)
      END FOR
      PRINT
END PROCEDURE
 
BEGIN
   NTH(0,25)
   NTH(250,265)
   NTH(1000,1025)
END PROGRAM
 