In English, we can abbreviate an ordinal numeral by appending the last two letters of the word with the corresponding number. For example, “first” can be abbreviated as “1st”; “second” can be formatted as “2nd”; “third” can be formatted as “3rd”; “fourth” can be formatted as “4th”.
Write a program that given some numbers, formats the corresponding English ordinal numerals.
Each line of input contains a natural number n where 0 < n < 10 000.
For each line of input there should be a line of output with the number given on the input followed by the English ordinal suffix.
1 2 3 4 56
1st 2nd 3rd 4th 56th
Your program should be implemented using two functions
suffix function should return a string with just the suffix.
ordinal function should return a string with the abbreviated ordinal
— the number followed by the suffix.
Please refer to the information for your chosen language:
suffix, ordinal :: Int -> String;
char* ordinal(int, char*);—
ordinalshould write the string to the given buffer and return a pointer to it whereas
suffixshould return a pointer to a static string;
Copyright © 2020-2021 Rudy Matela
All rights reserved