I would like to generate (as a return result of a function, or simply as the output of a program) the ordinal suffix of a positive integer concatenated to the number.
1st 2nd 3rd 4th ... 11th 12th 13th ... 20th 21st 22nd 23rd 24th
And so on, with the suffix repeating the initial 1-10 subpattern every 10 until 100, where the pattern ultimately starts over.
The input would be the number and the output the ordinal string as shown above.
What is the smallest algorithm for this?