N'th: Difference between revisions

1,275 bytes added ,  1 year ago
Add EasyLang
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
(Add EasyLang)
Line 1,623:
1010th 1011th 1012th 1013th 1014th 1015th 1016th 1017th 1018th 1019th
1020th 1021st 1022nd 1023rd 1024th 1025th</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
func nth num . ordinal$ .
num$ = num
lastTwoDigits$ = substr num$ len num$ - 1 2
lastDigit$ = substr num$ len num$ 1
if lastTwoDigits$ = "11" or lastTwoDigits$ = "12" or lastTwoDigits$ = "13"
ordinal$ = num$ & "th"
elif lastDigit$ = "1"
ordinal$ = num$ & "st"
elif lastDigit$ = "2"
ordinal$ = num$ & "nd"
elif lastDigit$ = "3"
ordinal$ = num$ & "rd"
else
ordinal$ = num$ & "th"
.
.
print "0 to 25:"
for i = 0 to 25
call nth i ordinal$
write ordinal$
write " "
.
print ""
print "250 to 265:"
for i = 250 to 265
call nth i ordinal$
write ordinal$
write " "
.
print ""
print "1000 to 1025:"
for i = 1000 to 1025
call nth i ordinal$
write ordinal$
write " "
.
</syntaxhighlight>
{{out}}
<pre>
0 to 25:
0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th
250 to 265:
250th 251st 252nd 253rd 254th 255th 256th 257th 258th 259th 260th 261st 262nd 263rd 264th 265th
1000 to 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>
 
=={{header|Elena}}==
175

edits