Returns
to
From main program,
main
program
XEQ
S
/
Program
Lines:
1 Description:
S01
LBL
S
—1 Starts the main subroutine.
S02
INPUT
fl
Enters
A.
S03
INPUT
B
Enters
B.
S04
INPUT
C
Enters
C.
S05
INPUT
0
Enters
D.
S06
RCL
0
Recalls
the
data
for
the
calcula
S07
RCL
C
tion
to
follow.
S08
RCL
B
S09
RCL
R
S10
x2
Calculates
A2.
Sll
XEQ
Q
Calculates
B2,
then A2 +
B1.
1
-&-S12
XEQ
Q
Calculates A2 + B2 + C2.
2
-OS
13
XEQ
Q
Calculates A2 + B2 + C2 + D2
3
-^S14
SQRT
Calculates
Va2
+
B2
+
C2-r-D2
Ends
main
subroutine;
returns
S15
RTN
execution to main program.
Q01
LBL
Q
Starts
nested
subroutine.
Q02
xOy
Squares
number
and
adds
it to
Q03
X*
the current sum of squares.
Q04
+
—
Q05
RTN
Ends
nested
subroutine,
0;
re-
turns
to first
subroutine,
S.
Branching
(GTO)
As we
have
seen
with
subroutines,
it is
often
desirable to transfer exe
cution to a part of the program other than the next line. This is called
branching.
6:
Programming
Techniques
93