
108
108
108
108 Section 9:
Section 9:
Section 9:
Section 9: Branching and Loopin
Branching and Loopin
Branching and Loopin
Branching and Looping
gg
g
File name: HP 12c+_user's guide_English_E_HDP0F12AE03_062608 - Modified.doc
Page: 108 of 213
Printed Date: 2021/6/16
Dimension: 14.8 cm x 21 cm
The program line immediately following that containing the conditional test
instruction can contain any instruction; however, the most commonly used
instruction there is
(
. If a
(
instruction follows a conditional test instruction,
program execution branches elsewhere in program memory if the condition is true
and continues with the next line in program memory if the condition is false.
Example:
Example:
Example:
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
and the tax rates — 20 and 25 — have been stored in
registers R
1
and R
2
, respectively.
Note:
Note:
Note:
Note:
If a program requires that certain numbers be in the X- and 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.
Содержание 0012C-90001
Страница 1: ...hp 12c financial calculator user s guide H Edition 5 HP Part Number 0012C 90001 ...
Страница 14: ......
Страница 15: ...Part I Part I Part I Part I Problem Solving Problem Solving Problem Solving Problem Solving ...
Страница 86: ......
Страница 87: ...Part II Part II Part II Part II Programming Programming Programming Programming ...
Страница 123: ...Part III Part III Part III Part III Solutions Solutions Solutions Solutions ...
Страница 169: ...Appendi Appendi Appendi Appendixes xes xes xes ...