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.)
I love Charlie's solution. Absolutely beautiful. I don't know if I ever would have thought of it. Charlie's method clearly identifies the VALUE of the maximum. But what if we want to know if the maximum is A vs B vs C? Here's an algorithm that I believe does the job. It is based on the fact that if XY=abs(XY) then X>=Y, if not then X<Y
IF AB=abs(AB)
IF AC=abs(AC)
THEN Return A
ELSE Return C
END IF
ELSEIF BC=abs(BC)
THEN Return B
ELSE Return C
END IF
ps, Penny, please email me, I have some programming questions, and you seem to be a guru. Thanks.
Larry
Edited on April 22, 2004, 8:37 pm
Edited on April 22, 2004, 10:50 pm
Edited on April 22, 2004, 11:05 pm

Posted by Larry
on 20040422 20:27:19 