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: procedure options (main);   /* 1 June 2014 */
   declare i fixed (10);
 
   do i = 0 to 25, 250 to 265, 1000 to 1025;
      if i = 250 | i = 1000 then put skip (2);
      put edit (enth(i)) (x(1), a);
   end;
 
enth: procedure (i) returns (character (25) varying);
   declare i fixed (10);
   declare suffix character (2);
 
   select (mod(i, 10));
      when (1)  suffix = 'st';
      when (2)  suffix = 'nd';
      when (3)  suffix = 'rd';
      otherwise suffix = 'th';
   end;
   select (mod(i, 100));
      when (11, 12, 13) suffix = 'th';
      otherwise ;
   end;
   return ( trim(i) || suffix );
end enth;
 
end Nth;