N'th: Difference between revisions
Content added Content deleted
(N'th in Run BASIC) |
(Added Chipmunk Basic) |
||
Line 1,329: | Line 1,329: | ||
Set [1000,1025] : |
Set [1000,1025] : |
||
1000th 1001st 1002nd 1003rd 1004th 1005th 1006th 1007th 1008th 1009th 1010th 1011th 1012th 1013th 1014th 1015th 1016th 1017th 1018th 1019th 1020th 1021st 1022nd 1023rd 1024th 1025th</pre> |
1000th 1001st 1002nd 1003rd 1004th 1005th 1006th 1007th 1008th 1009th 1010th 1011th 1012th 1013th 1014th 1015th 1016th 1017th 1018th 1019th 1020th 1021st 1022nd 1023rd 1024th 1025th</pre> |
||
=={{header|Chipmunk Basic}}== |
|||
{{works with|Chipmunk Basic|3.6.4}} |
|||
{{trans|BASIC256}} |
|||
<syntaxhighlight lang="qbasic">100 cls |
|||
110 imprimeordinal(0,25) |
|||
120 print : print |
|||
130 imprimeordinal(250,265) |
|||
140 print : print |
|||
150 imprimeordinal(1000,1025) |
|||
160 print |
|||
170 end |
|||
180 sub ordinal$(n) |
|||
190 ns$ = str$(n) |
|||
200 ordinal$ = "" |
|||
210 select case right$(ns$,1) |
|||
220 case "1" |
|||
230 if right$(ns$,2) = "11" then ordinal$ = ns$+"th" : goto 340 |
|||
240 ordinal$ = ns$+"st" : goto 340 |
|||
250 case "2" |
|||
260 if right$(ns$,2) = "12" then ordinal$ = ns$+"th" : goto 340 |
|||
270 ordinal$ = ns$+"nd" : goto 340 |
|||
280 case "3" |
|||
290 if right$(ns$,2) = "13" then ordinal$ = ns$+"th" : goto 340 |
|||
300 ordinal$ = ns$+"rd" : goto 340 |
|||
310 case else |
|||
320 ordinal$ = ns$+"th" : goto 340 |
|||
330 end case |
|||
340 return |
|||
350 sub imprimeordinal(a,b) |
|||
360 for i = a to b |
|||
370 print ordinal$(i);" "; |
|||
380 next i |
|||
390 return</syntaxhighlight> |
|||
=={{header|Clojure}}== |
=={{header|Clojure}}== |