Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Nth/MATLAB/nth.m
Normal file
18
Task/Nth/MATLAB/nth.m
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function s = nth(n)
|
||||
tens = mod(n, 100);
|
||||
if tens > 9 && tens < 20
|
||||
suf = 'th';
|
||||
else
|
||||
switch mod(n, 10)
|
||||
case 1
|
||||
suf = 'st';
|
||||
case 2
|
||||
suf = 'nd';
|
||||
case 3
|
||||
suf = 'rd';
|
||||
otherwise
|
||||
suf = 'th';
|
||||
end
|
||||
end
|
||||
s = sprintf('%d%s', n, suf);
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue