Simple Programming
12–15
File name 33s-E-Manual-1008-Publication(1st).doc Page : 386
Printed Date : 2003/10/8 Size : 13.7 x 21.2 cm
Example: INPUT, VIEW, and Messages in a Program.
Write an equation to find the surface area and volume of a cylinder given its
radius and height. Label the program C (for cylinder), and use the variables S
(surface area), V (volume), R (radius), and H (height). Use these formulas:
V =
π
R
2
H
S = 2
π
R
2
+ 2
π
RH = 2
π
R ( R + H )
Keys:
(In RPN mode)
Display: Description:
¹
£
¹
r
Ë
Ë
Pro
ram, entry; sets pointer
to top of memory.
¹
Ó
C
Labels program.
¹
Ç
R
¹
Ç
H
Instructions to prompt for
radius and height.
º
d
º
j
¸
h
R
)
2
¸
h
H
Ï
π
Calculates the volume.
º
Î
Checksum and length of
equation.
e
V
Store the volume in V.
º
d
2
¸ º
j
¸ h
R
¸
º
y
h
R
Ù
h
H
º
|
Ï
π
Calculates the surface area.
º
Î
Checksum and length of
equation.
e
S
Stores the surface area in S.
º
·
{
}
Ë
0
Sets flag 10 to display
equations.