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.)
The larger of two numbers (x and y) can be expressed as [x+y+abs(x-y)]/2
Similarily, the smaller of two numbers is [x+y-abs(x-y)]/2
Using these two formulas, formulas for the largest, smallest and median values can be formed:
Smallest = [[a + b - abs(b-a)]/2 + c - abs([a + b - abs(b-a)]/2 - c)]/2
Largest = [[a + b + abs(b-a)]/2 + c + abs([a + b + abs(b-a)]/2 - c)]/2
Median = a + b + c - Largest - Smallest
Edited on April 22, 2004, 3:29 pm