HP Forums

Full Version: (71B) Digital Root of Integers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Add all the numbers of an integer and repeat until you have a single digit (1-9).

Program DROOT (52 bytes)

10 DESTROY N
20 INPUT “INTEGER:”;N
22 N=IP(N)
30 D=1+MOD(N-1,9)
40 DISP D
Reference URL's