I bought 4 items at a store having a broken cash register. The clerk used a calculator to add them up, but hit the multiplication key instead of the addition key and told me the result was $7.02. When I pointed out the error, he added them up and reported the same final bill! Is this possible, or was another error made?
DEFDBL A-Z
tot = 702
FOR a = 1 TO tot / 4
FOR b = a TO (tot - a) / 3
ab = a * b
FOR c = b TO (tot - a - b) / 2
d = tot - a - b - c
abcd = ab * c * d
IF abcd = 702000000 THEN PRINT a; b; c; d
NEXT
NEXT
NEXT
produces
117 125 160 300
or, with the appropriate decimal points
1.17 1.25 1.60 3.00
|
Posted by Charlie
on 2013-08-30 17:29:10 |