Sum digits of an integer: Difference between revisions
→{{header|RPL}}: slightly improved
(→{{header|Palo Alto Tiny BASIC}}: Added a solution.) |
(→{{header|RPL}}: slightly improved) |
||
Line 4,110:
RPL can natively handle numbers in bases 2,8,10 or 16, but displays them according to the current base mode. For example, when you type #256d, it will be immediately turned into #100h if HEX mode is active. As there is no way to force the base mode to the base used for input, switching to string handling looks like a reasonable approach for code clarity and size. A side effect is that it can proceed with numbers in any base between 2 and 16.
{{works with|Halcyon Calc|4.2.7}}
≪ →STR
'''NEXT'''
≫ ≫ '<span style="color:blue">DIGITS</span>' STO
1 <span style="color:blue">DIGITS</span>
1234 <span style="color:blue">DIGITS</span>
#FEh <span style="color:blue">DIGITS</span>
#F0Eh <span style="color:blue">DIGITS</span>
{{out}}
<pre>
|