Section 8: Program Editing127
Keystrokes Display    
X Y 
  08 X<>Y    
  Moves the height (h) into the X-register.
g RCL 01
  09 RCL 01    
  Recalls the radius (r) from storage register R01.
 ×  
  10 *    
  Multiplies r and h (rh).
g   
  11 PI    
  Summons the quantity π.
 ×  
  12 *    
  Computes πrh.
  13 2 _    
   
 ×  
  14 *    
  Computes 2πrh.
 +  
  15 +    
  Computes S = (2πr2) + (2πrh).
g GTO · · 
  00 REG 40    
  Ends the program and tells you how many registers are left in program memory.
Before you can run the AREA program, you must initialize it.
Initializing a Program
When you initialize a program, all you do is set up all of the required inputs and mode settings prior to the actual running of it. Some programs contain initializing routines that set up the data to run the program. In other programs, like AREA, you may have to initialize the program manually from the keyboard.
In our AREA program, we must place the height (h) into the Y-register of the stack and the radius (r) into the X-register. To initialize AREA with the values of 50 inches for h and 11 inches for r:
Keystrokes Display    
PRGM 
  0.0000    
  Takes the HP-41C out of program mode.
50 
  50 _    
  The h value.
ENTER  
  50.0000    
  The h value is in the Y-register.
11 
  11 _    
  The r value is in the X-register.
The AREA program, which solves for the total area of a cylinder, is now initialized for height 50 inches and radius of 11 inches.