HP Forums
(12C) Lowest Unit Cost - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (12C) Lowest Unit Cost (/thread-11821.html)



(12C) Lowest Unit Cost - Gamo - 11-19-2018 06:30 AM

Program for budget minded shoppers that repeatedly choose the least
costly (lowest unit cost) of equivalent items.

Procedure:

First Item follow by Second Item

(1st) Price [ENTER] Quantity [ENTER]
(2nd) Price [ENTER] Quantity [R/S] --> Answer

If First Item is cheaper display answer shown 1
If Second Item is cheaper display answer show 2
If both are equal display answer show 3

Example:

Item #1
13 ounces at $1.63
Item #2
17 ounces at $2.15

1.63 [ENTER] 13 [ENTER] 2.15 [ENTER] 17 [R/S] display 1

Answer: Item #1 is cheaper than Item #2

Program:
Code:

01  ÷
02 STO 1
03 Rv
04  ÷
05 STO 2
06 X<>Y
07 Rv
08  -
09 X=0
10 GTO 19
11 RCL 2
12 RCL 1
13 X≤Y 
14 GTO 17
15  1
16 GTO 00
17  2
18 GTO 00
19  3
20 GTO 00

Gamo