QUESTION 61 · Operators
Write a conditional expression to select the larger of a and b.
2 marksAnswer
a > b ? a : b selects the larger value.
- A true condition selects a; otherwise it selects b.
- Only the selected alternative is evaluated. If a and b are equal, selecting b still gives the maximum value.