If max is a function that returns greatest of given two numbers then which of the following will return greatest of three numbers
Answers
Answered by
1
Explanation:
The equation you've given returns the maximum of two numbers; that is,
max{a,b}=a+b+|a−b|2
To see this, simply note that if a≥b, we have
a+b+|a−b|=a+b+(a−b)=2a
and if a<b,
a+b+|a−b|=a+b−(a−b)=2b
Then to find the largest of three numbers, simply compare the first two, and then compare the result with the third number.
Similar questions