HP 12C Platinum Owner's Handbook Manual page 104

And problem-solving guide
Hide thumbs Also See for 12C Platinum:
Table of Contents

Advertisement

106
Section 9: Branching and Looping
rogram Execution
If True
rogram execution
continues at line 007
Example: The following program calculates income tax at a rate of 20% on
incomes of $20,000 or less and 25% on incomes of more than $20,000. To
conserve program lines, the program assumes that the test value – 20,000 – has
been stored in register R
0
registers R
and R
, respectively.
1
2
If a program requires that certain numbers be in the X- and
Note:
Y-registers when instructions such as o are executed, it is extremely
helpful when writing the program to show the quantities in each register
after each instruction is executed, as in the following diagram.
i n c o m e
Ke y s
i n c o m e
L i n e
Keys
Line
We'll key the income into the display before running the program so that it will
be in the X-register when the :0 instruction in program line 001 is executed.,
This instruction will place the test value 20,000 in the X-register and (as
explained in Appendix A) move the income into the Y-register. The ~
instruction in program line 002 will exchange the numbers in the X- and
rogram Execution
1 ,
2,
3,
4,
5,
6,
7,
8,
and the tax rates – 20 and 25 – have been stored in
i n c o m e
i n c o m e
0 0 1
0 0 2
income income income income
#
$
If False
rogram execution
continues at line 004
i n c o m e
i n c o m e
0 0 7
0 0 3
0 0 4
tax
%
&

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents