Using only standard math operators (+, , *, /) and functions (absolute value, square root, powers, and so on), give a function that calculates MAX(A,B,C).
Alternate version, for programmers only: using any language (BASIC, C, Excel, whatever) find the maximum of A, B, and C, but be careful when writing the program, because you cannot use the "" key, for it's broken (thus writing things like IF A>B is impossible...) and you cannot use the "M" key either, for it's also broken (...and writing H=MAX(A,B) is also not possible.)
DO
INPUT a, b, c
ab = (a + b) / 2 + ABS(a  b) / 2
abc = (ab + c) / 2 + ABS(ab  c) / 2
PRINT abc
LOOP
The above finds for example:
? 2,5,9
9
? 9,1,4
9
? 2,18, 1
18
The lines doing the calculation could be simplified of course as there is a common denominator of 2, but the way it appears shows its origin of having taken the average between two numbers and then adding half the absolute value of the difference. That gives the higher of two numbers. Then you just find the higher between that and the third number, using the same method.

Posted by Charlie
on 20040421 15:46:29 