Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Nth/Mathematica/nth.math
Normal file
12
Task/Nth/Mathematica/nth.math
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
suffixlist = {"th", "st", "nd", "rd", "th", "th", "th", "th", "th","th"};
|
||||
addsuffix[n_] := Module[{suffix},
|
||||
suffix = Which[
|
||||
Mod[n, 100] <= 10, suffixlist[[Mod[n, 10] + 1]],
|
||||
Mod[n, 100] > 20, suffixlist[[Mod[n, 10] + 1]],
|
||||
True, "th"
|
||||
];
|
||||
ToString[n] <> suffix
|
||||
]
|
||||
addsuffix[#] & /@ Range[0, 25] (* test 1 *)
|
||||
addsuffix[#] & /@ Range[250, 265] (* test 2 *)
|
||||
addsuffix[#] & /@ Range[1000, 1025] (* test 3 *)
|
||||
Loading…
Add table
Add a link
Reference in a new issue