Section 11: Branching and Looping166
Now run the program:
Keystrokes Display    
PRGM 
  0.0000    
  Takes the HP-41C out of PRGM mode.
XEQ 
       
   
ALPHA EVENS ALPHA 
  2.0000    
  When the HP-41C begins executing the program, it first pauses to display the number, then pauses to display its square. When the loop counter increments beyond 50, the program stops.
 
  4.0000    
 
 
       
 
 
  4.0000    
 
 
  16.0000    
 
 
      ·    
 
 
      ·    
   
 
      ·    
   
 
  50.0000    
   
 
  2,500.0000    
   
Example: The island of Manhattan was sold in the year 1624 for $24.00. The program below shows how the amount would have grown each year if the original amount had been placed in a bank account drawing 6% interest compounded annually. The program prompts for the number of years and alters that number for use by DSE . The DSE is used to control the number of iterations through the loop.
Keystrokes Display    
PRGM 
       
   
g GTO · · 
  00 REG 46    
   
g LBL 
       
   
ALPHA GOTHAM ALPHA 
  01 LBLTGOTHAM    
  The program name.
ALPHA YEARS? ALPHA 
  02TYEARS?    
  The ALPHA prompt.
XEQ 
       
   
ALPHA PROMPT ALPHA 
  03 PROMPT    
  Displays prompt and stops for input.
STO 00
  04 STO 00    
   
1624
  05 1624 _    
   
STO 01
  06 STO 01    
   
24
  07 24 _    
   
STO 02
  08 STO 02    
   
g LBL 01
  09 LBL 01    
  The beginning of the loop.
RCL 02
  10 RCL 02    
   
6
  11 6 _    
   
g  %  
  12 %    
   
STO  +  02 
  13 STO + 02