All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Finding the maximum (Posted on 2004-04-21) Difficulty: 3 of 5
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.)

  Submitted by e.g.    
Rating: 4.0000 (5 votes)
Solution: (Hide)
P = (A+B + ABS(A-B)) / 2
Q = (P+C + ABS(P-C)) / 2
answer is Q

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Solutionpuzzle solutionK Sengupta2007-04-15 15:25:48
re: SolutionMike2004-11-20 22:09:01
Are A, B & C integers or floating numbers?P C2004-05-05 12:43:39
SolutionLotsa IF'sLarry2004-04-22 20:27:19
SolutionSuper-Corrected VisualBasic Program (conforms to the problem requirements)Penny2004-04-22 18:16:02
Charlie's ProgramPenny2004-04-22 17:17:06
SolutionCorrected Visual Basic programPenny2004-04-22 16:44:57
re: Visual Basic programPenny2004-04-22 11:42:50
SolutionVisual Basic programPenny2004-04-22 09:57:44
Low, Median and HighBrian Smith2004-04-21 20:06:02
Some ThoughtsAlternate absolute valueFederico Kereki2004-04-21 19:52:28
re(2): programming solutionDJ2004-04-21 17:12:49
re(2): programming solutionSilverKnight2004-04-21 17:00:33
Questionre: programming solutionAdy TZIDON2004-04-21 16:23:06
SolutionSolutionBrian Wainscott2004-04-21 16:18:27
Solutionprogramming solutionCharlie2004-04-21 15:46:29
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information