Post Reply 
(20S and 21S) Minimum and Maximum
06-03-2017, 05:06 PM
Post: #1
(20S and 21S) Minimum and Maximum
The input/output format is the same for both minimum and maximum:

1. Enter the initial data point, press XEQ A.
2. Enter subsequent points, press XEQ B.
3. To find the minimum or maximum, depending on which program you use, press XEQ C.

The key codes for both the HP 20S and HP 21S for these programs are the same. Caution: this won’t always be the case. The HP 20S has a row dedicated to conversions while the HP 21S has a row dedicated to statistics.

HP 20S and HP 21S: Minimum
Code:

STEP    CODE    KEY
01    61, 41, A    LBL A
02    21, 1    STO 1
03    61, 26     RTN
04    61, 41, B    LBL B
05    21, 0    STO 0
06    31    INPUT
07    22, 1    RCL 1
08    61, 42    X≤Y?
09    51, 41, 1    GTO 1
10    71    Clear [ C ]
11    61, 26    RTN
12    61, 41, 1    LBL 1
13    51, 31     SWAP
14    21, 1    STO 1
15    71    Clear [ C ]
16    61, 26    RTN
17    61, 41, C    LBL C
18    22, 1    RCL 1
19    61, 26    RTN

Example:
Data Set: 9, 3, 6, 5, 7, 2, 4
Minimum: 2 (stored in R1)

HP 20S and HP 21S: Maximum
Code:

STEP    CODE    KEY
01    61, 41, A    LBL A
02    21, 1    STO 1
03    61, 26     RTN
04    61, 41, B    LBL B
05    21, 0    STO 0
06    31    INPUT
07    22, 2    RCL 2
08    51, 31    SWAP
09    61, 41    X≤Y?
10    51, 41, 2    GTO 2
11    71    Clear [ C ]
12    61, 26    RTN
13    61, 41, 2    LBL 2
14    21, 2    STO 2
15    71    Clear [ C ]
16    61, 26    RTN
17    61, 41, C    LBL C
18    22, 2    RCL 2
19    61, 26    RTN

Example:
Data Set: 9, 3, 6, 5, 7, 2, 4
Maximum: 9 (stored in R2)

This is two of my favorite programs I posted this year. I plan to make a version for the HP 12C soon. They are simple and versatile.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)