N'th: Difference between revisions
Content added Content deleted
m (→{{header|Befunge}}: Minor changes to description.) |
Simple9371 (talk | contribs) (Added Batch File....) |
||
Line 239: | Line 239: | ||
1018'th 1017'th 1016'th 1015'th 1014'th 1013'th 1012'th 1011'th 1010'th 1009'th |
1018'th 1017'th 1016'th 1015'th 1014'th 1013'th 1012'th 1011'th 1010'th 1009'th |
||
1008'th 1007'th 1006'th 1005'th 1004'th 1003'rd 1002'nd 1001'st 1000'th</pre> |
1008'th 1007'th 1006'th 1005'th 1004'th 1003'rd 1002'nd 1001'st 1000'th</pre> |
||
=={{header|Batch File}}== |
|||
<lang dos>@echo off |
|||
::Main thing... |
|||
call :Nth 0 25 |
|||
call :Nth 250 265 |
|||
call :Nth 1000 1025 |
|||
pause |
|||
exit /b |
|||
::The subroutine |
|||
:Nth <lbound> <ubound> |
|||
setlocal enabledelayedexpansion |
|||
for /l %%n in (%~1,1,%~2) do ( |
|||
set curr_num=%%n |
|||
set "out=%%nth" |
|||
if !curr_num:~-1!==1 (set "out=%%nst") |
|||
if !curr_num:~-1!==2 (set "out=%%nnd") |
|||
if !curr_num:~-1!==3 (set "out=%%nrd") |
|||
set "range_output=!range_output! !out!" |
|||
) |
|||
echo."!range_output:~1!" |
|||
goto :EOF</lang> |
|||
{{Out}} |
|||
<pre>"0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11st 12nd 13rd 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th" |
|||
"250th 251st 252nd 253rd 254th 255th 256th 257th 258th 259th 260th 261st 262nd 263rd 264th 265th" |
|||
"1000th 1001st 1002nd 1003rd 1004th 1005th 1006th 1007th 1008th 1009th 1010th 1011st 1012nd 1013rd 1014th 1015th 1016th 1017th 1018th 1019th 1020th 1021st 1022nd 1023rd 1024th 1025th" |
|||
Press any key to continue . . .</pre> |
|||
=={{header|BBC BASIC}}== |
=={{header|BBC BASIC}}== |