GATE 2017 CS – Question 8
The expression $\dfrac{(x + y) - |x - y|}{2}$ is equal to
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (B) the minimum of $x$ and $y$
Explanation
If $x \geq y$ then $|x - y| = x - y$ and the expression is $\frac{x + y - x + y}{2} = y$, the smaller value. If $x < y$ it is $\frac{x + y - y + x}{2} = x$, which is again the smaller value. So it gives the minimum of $x$ and $y$.