September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
16
Task/Nth/Phix/nth.phix
Normal file
16
Task/Nth/Phix/nth.phix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
constant ordinals = {"th","st","nd","rd"}
|
||||
|
||||
function Nth(integer n, bool apostrophe=false)
|
||||
integer mod10 = mod(n,10)+1
|
||||
if mod10>4 or mod(n,100)=mod10+9 then mod10 = 1 end if
|
||||
return sprintf("%d%s",{n,repeat('\'',apostrophe)&ordinals[mod10]})
|
||||
end function
|
||||
|
||||
constant ranges = {{0,25},{250,265},{1000,1025}}
|
||||
for i=1 to length(ranges) do
|
||||
for j=ranges[i][1] to ranges[i][2] do
|
||||
if mod(j,10)=0 then puts(1,"\n") end if
|
||||
printf(1," %6s",{Nth(j,i=2)})
|
||||
end for
|
||||
puts(1,"\n")
|
||||
end for
|
||||
Loading…
Add table
Add a link
Reference in a new issue