N'th: Difference between revisions
Content added Content deleted
(→{{header|XBasic}}: Removed unnecessary spaces before numbers) |
|||
Line 2,763: | Line 2,763: | ||
<lang xbasic> |
<lang xbasic> |
||
PROGRAM "nth" |
PROGRAM "nth" |
||
VERSION "0. |
VERSION "0.0002" |
||
DECLARE FUNCTION Entry() |
DECLARE FUNCTION Entry() |
||
Line 2,779: | Line 2,779: | ||
nMod100@@ = n&& MOD 100 |
nMod100@@ = n&& MOD 100 |
||
SELECT CASE TRUE |
SELECT CASE TRUE |
||
CASE (nMod10@@ = 1) AND (nMod100@@ <> 11): |
CASE (nMod10@@ = 1) AND (nMod100@@ <> 11): |
||
RETURN ("st") |
|||
CASE (nMod10@@ = |
CASE (nMod10@@ = 2) AND (nMod100@@ <> 12): |
||
RETURN ("nd") |
|||
CASE (nMod10@@ = 3) AND (nMod100@@ <> 13): |
|||
RETURN ("rd") |
|||
CASE ELSE: |
|||
RETURN ("th") |
|||
END SELECT |
END SELECT |
||
END FUNCTION |
END FUNCTION |
||
Line 2,788: | Line 2,792: | ||
FUNCTION PrintImages(loLim&&, hiLim&&) |
FUNCTION PrintImages(loLim&&, hiLim&&) |
||
FOR i&& = loLim&& TO hiLim&& |
FOR i&& = loLim&& TO hiLim&& |
||
PRINT i&&; Suffix$(i&&); " "; |
PRINT TRIM$(STRING$(i&&)); Suffix$(i&&); " "; |
||
NEXT |
NEXT |
||
PRINT |
PRINT |
||
Line 2,796: | Line 2,800: | ||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
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 |
|||
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 1011th 1012th 1013th 1014th 1015th 1016th 1017th 1018th 1019th 1020th 1021st 1022nd 1023rd 1024th 1025th |
|||
</pre> |
</pre> |
||