HP 0012C-90001 User Manual page 110

12c financial calculator
Table of Contents

Advertisement

110 Section 9:
110
Section 9: Branching and Loopin
Branching and Looping g g g
110
110
Section 9:
Section 9:
Branching and Loopin
Branching and Loopin
Keystrokes
Keystrokes
Keystrokes
Keystrokes
g(07
:2
g(08
:1
b
fs
Now, we'll store the required numbers in registers R
the program, using Ê so that we can check that the branching occurs properly.
It's good practice with programs containing conditional test instructions to check
that the program branches correctly for all possible conditions: in this case, if the
income is less than, equal to, or greater than the test value.
Keystrokes
Keystrokes
Keystrokes
Keystrokes
20000?0
20?1
25?2
15000
Ê
Ê
Ê
Ê
Display
Display
Display
Display
04- 43, 33
07
If condition is true, branches to
program line 07.
05-
45
2
If condition is false, recalls 25% tax
rate to X-register.
06- 43, 33
08
Branches to program line 08.
07-
45
1
Recalls 20% tax rate to X-register.
08-
25
Calculates tax.
–12.36
Sets calculator to Run mode.
(Display shows results of running of
previous program.)
Display
Display
Display
Display
20,000.00
Stores test value in register R
20.00
Stores 20% tax rate in register R
25.00
Stores 25% tax rate in register R
15,000.
Keys income less than test value into
display and X-register.
Line 01: :0.
01-
45
0
20,000.00
Test value has been recalled to
X-register, moving income to
Y-register.
Line 02: ~
02-
34
15,000.00
Income has been placed in
X-register and test value has been
placed in Y-register.
Line 03: go
03-
43
34
15,000.00
Condition tested by o was true,
04- 43, 33
07
so program execution continued
with line 04: g(07.
, R
, and R
, then we'll run
0
1
2
0
.
.
1
.
2

Advertisement

Table of Contents
loading

Table of Contents