Post Reply 
(11C) Digit Sum
01-20-2018, 08:14 AM
Post: #3
RE: (11C) Digit Sum
I like this program very much too.

I've made a little modification to operate only in the stack, avoiding the use of the register 1.
Code:

LBL A
0
X<>Y
LBL 0
1
0
÷
FRAC
LST X
R↓
+
R^
INT
X̣!=0?
GTO 0
R↓
1
0
x
RTN

and here is a HP42s version of this program with a little modification in the way I use the stack
Code:

00 { 38-Byte Prgm }
01▸LBL "SumDg"
02 0
03 10
04▸LBL 00
05 STO÷ ST Z
06 RCL ST Z
07 IP
08 X=0?
09 GTO 01
10 X<> ST T
11 FP
12 STO+ ST Z
13 R↓
14 GTO 00
15▸LBL 01
16 R↓
17 X<> ST Z
18 +
19 ×
20 RTN
21 END
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) Digit Sum - Gamo - 01-16-2018, 08:52 AM
RE: (11C) Digit Sum - Dieter - 01-16-2018, 07:16 PM
RE: (11C) Digit Sum - wawa - 01-20-2018 08:14 AM
RE: (11C) Digit Sum - Dieter - 01-20-2018, 09:23 AM
RE: (11C) Digit Sum - Gamo - 01-20-2018, 10:10 AM
RE: (11C) Digit Sum - Dieter - 01-20-2018, 05:21 PM



User(s) browsing this thread: 1 Guest(s)