Jump to content

N'th: Difference between revisions

m
Corrected Forth code to produce 1011th, 1012th,1013th instead of 1011st, 1012nd, 1013rd
m (Corrected Forth code to produce 1011th, 1012th,1013th instead of 1011st, 1012nd, 1013rd)
Line 1,825:
<syntaxhighlight lang="forth">: 'nth ( -- c-addr ) s" th st nd rd th th th th th th " drop ;
: .nth ( n -- )
dup 100 mod 10 20 within if 0 .r ." th " exit then
dup 0 .r 10 mod 3 * 'nth + 3 type ;
 
Line 1,849:
1000th 1001st 1002nd 1003rd 1004th
1005th 1006th 1007th 1008th 1009th
1010th 1011st1011th 1012nd1012th 1013rd1013th 1014th
1015th 1016th 1017th 1018th 1019th
1020th 1021st 1022nd 1023rd 1024th
1024th1022th ok</pre>
 
=={{header|Fortran}}==
1

edit

Cookies help us deliver our services. By using our services, you agree to our use of cookies.