Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 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