Section 14: Flags continue233
Problems:
  1. One mile is equal to 1.609344 kilometers. Use the following flowchart below to create and load a program that will permit you to key in distances in either miles ( LBL MILE) or kilometers ( LBL KILO). Using a flag and a subroutine, either multiply or divide to convert from one unit of measure to the other. (Hint: 1/X  ×  yields the same as  ÷  .)
    Run the program to convert 187,000 miles to kilometers; to convert 1.2701 kilometers to miles.
    (Answers: 300,947.3280 kilometers; 0.7892 miles.)
 
Key in
miles
Start
         
Key in
kilometers
Start
 
                     
 
Clear flag
         
Set flag
 
                     
                     
                       
         
Place 1.609334 in X
         
                       
     
No
No
No
No
Is flag set?
Yes
Yes
Yes
Yes
     
       
 
Multiply
         
Divide
 
                     
                       
         
Stop
         
  2. Rewrite the timing program you input on page 229 so that it counts the number of times the flag was set (successful timings). Store that number in a register so you can check the total later.