Get The Nth Digit of an Integer on an HP-35s

By | April 21, 2014

Here is a simple program for the HP-35s pocket calculator, to get the nth digit of an integer:

M001 LBL M
M002 10x
M003 ÷
M004 ENTER
M005 INTG
M006 -
M007 10
M008 ×
M009 INTG
M010 RTN

The program assumes two parameters on the stack, first is the integer, second is the number of the digit it should extract.

Example input to get the 4th digit from right for the number 123456789:

123456789
ENTER
4
XEQ M
ENTER

Result is 6!

Leave a Reply

Your email address will not be published. Required fields are marked *