Post Reply 
(35S) Reverse Digits Programme
05-12-2015, 05:00 PM (This post was last modified: 06-15-2017 01:58 PM by Gene.)
Post: #1
(35S) Reverse Digits Programme
The programme REVERSO takes integer input & returns the digit reversed integer.

eg Input 123 returns 321.

1 LBL R
2 0
3 x<>y
4 x=0?
5 GTO R009
6 10*REGY+RMDR(REGX,10)
7 IDIV(REGY,10)
8 GTO R004
9 R↓
10 RTN
Find all posts by this user
Quote this message in a reply
05-19-2015, 07:25 AM
Post: #2
RE: HP 35S: Reverse Digits Programme
A slight optimization of REVERSO, one line smaller & faster for entry > 0, slower for 0. Why bother to optimize? speed difference is negligible, 35S has more than enough memory...it's just that I feel an irritation when I see the waste looking up at me from the page.

1 LBL R
2 0
3 x<>y
4 10*REGY+RMDR(REGX,10)
5 IDIV(REGY,10)
6 x≠0?
7 GTO R004
8 R↓
9 RTN
Find all posts by this user
Quote this message in a reply
Post Reply 




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