EasyManuals Logo
Home>HP>Calculator>15c Collector's Edition

HP 15c Collector's Edition User Manual

HP 15c Collector's Edition
308 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #116 background imageLoading...
Page #116 background image
104 Section 9: Subroutines
Example: Nesting. The following subroutine, labeled “.4”, calculates the
value of the expression
x
2
+y
2
+z
2
+
t
2
as part of a larger calculation
in a larger program. The subroutine calls upon another subroutine (a
nested subroutine), labeled “.5”, to do the repetitive squaring.
The program is executed after placing the variables t, z, y, and x into the
T-, Z-, Y-, and X-registers.
Keystrokes
´
b
.4
Start of main
subroutine.
|
x
2
.
G
.5
Calculates
y
2
and
2
y
2
.
G
.5
1
Calculates
2
and
2
y
2
2
.
G
.5
2
Calculates
t
2
and
2
y
2
2
t
2
.
¤
3
x
2
+ y
2
+ z
2
+ t
2
|
n
End of main subroutine;
returns to main program.
´
b
.5
Start of nested
subroutine.
®
|
x
Calculates a square and
adds
it to current sum of
squares.
+
|
n
End of nested sub
-
routine;
returns to main subroutine.
If you run the subroutine (with its nested subroutine) alone using x = 4.3,
y = 7.9, z = 1.3, and t = 8.0, the answer you get upon pressing G .4 is
12.1074.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP 15c Collector's Edition and is the answer not in the manual?

HP 15c Collector's Edition Specifications

General IconGeneral
BrandHP
Model15c Collector's Edition
CategoryCalculator
LanguageEnglish

Related product manuals