Largest int from concatenated ints: Difference between revisions
Content added Content deleted
(add RPL) |
|||
Line 2,436: | Line 2,436: | ||
998764543431 |
998764543431 |
||
6054854654 |
6054854654 |
||
</pre> |
|||
=={{header|RPL}}== |
|||
We use here the second algorithm, easily derived from the SORT program given in [[Sorting algorithms/Bubble sort#RPL|Sorting algorithms/Bubble sort]]. |
|||
{{works with|HP|28}} |
|||
≪ LIST→ → len |
|||
≪ 1 len '''START''' |
|||
→STR len ROLL '''END''' |
|||
len 1 '''FOR''' n |
|||
1 n 1 - '''START''' |
|||
'''IF''' DUP2 + LAST SWAP + < '''THEN''' SWAP '''END''' |
|||
n ROLLD |
|||
'''NEXT''' n ROLLD |
|||
-1 '''STEP''' |
|||
2 len '''START''' + '''END''' STR→ |
|||
≫ ≫ ‘<span style="color:blue">MKBIG</span>’ STO |
|||
{212 21221} <span style="color:blue">MKBIG</span> |
|||
{1 34 3 98 9 76 45 4} <span style="color:blue">MKBIG</span> |
|||
{54 546 548 60} <span style="color:blue">MKBIG</span> |
|||
{{out}} |
|||
<pre> |
|||
3: 21221221 |
|||
2: 998764543431 |
|||
1: 6054854654 |
|||
</pre> |
</pre> |
||