HP 9g Writing a Small Program

hp9g programming

Notice that the way of assigning a value to a variable is different from the way used in the entry line. In Program Edit mode, to store a value into a variable, we have to use variable = value (i.e. the {Alpha} {=} key), whereas in the entry line the syntax is value ¨ variable (i.e. the {Save} key).

Example 1: Calculate the ratio between and F15 F16

Solution: Once the above program has been keyed in, run it by pressing {prog} (0-9) {=}. The message ‘N=’ is displayed in the entry line. Enter the first value ({1} {5} {=}, notice that the value entered can be the result of a calculation, e.g. A+3). The result appears in the entry line: 610. To find the next term, just press {=} and the program restarts. Pressing 1x 6v = returns in a couple of seconds: 987.

Answer: The ratio is 987 / 610 = 1.618