# HP 12C Platinum User Manual Page 134

Financial calculator.

Advertisement

134 Section 9: Branching and Looping
Keystrokes
(RPN mode)
go
gi007
:2
gi008
:1
b
fs
ALG program notes: We'll key the income into the display before running the
program. We'll store it in R
chapter. By keying the income into the display before running the program, we
ensure that it will be in the X-register when the :0 instruction in program line
002 is executed. This instruction will place the test value 20,000 in the X-register
and move the income into the Y-register. The ~ instruction in program line 003
will exchange the numbers in the X- and Y-registers: that is, it will place the income
back into the X-register and place the test value into the Y-register. This is
necessary because when either the :2 instruction in line 007 or the :1
instruction in line 009 is executed, the number in the X-register is moved into the
Y-register; if the ~ instruction were not included, the test value 20,000, rather
than the income, would be in the Y-register when the b instruction in line 010 is
executed.
Keystrokes
(ALG mode)
f[
fs
fCLEARÎ
?9
Display
003,
43
34
004,43, 33, 007
005,
45
2
006,43, 33, 008
007,
45
1
008,
25
–190.22
so it will be available for the examples in the next
9
Display
007,43, 33, 002
000,
001,
44
9
Tests whether number in X-register
(income) is less than or equal to
number in Y-register (20,000).
If condition is true, branches to
program line 007.
If condition is false, recalls 25%
tax rate to X-register.
Branches to program line 008.
Recalls 20% tax rate to X-register.
Calculates tax.
Sets calculator to Run mode.
(Display shows results of running
of previous program.)
Sets calculator to Program mode.
(Display shows program line at
which execution was halted at
end of preceding example.)
Clears program memory.
Stores income into register R
.
9

Advertisement

Table of Contents

Symbols: 0