The value of y is 4
From the information given, we have that the expression y = (x > 6 ? 4:6) is a ternary conditional operator in programming, which evaluates the condition x > 6
Now , we can deduce from the expression that;
- if the given value x is greater than 6, then the y get assigned to 4.
- if the x value is not greater than 6 then y get assigned to 6.
Since, we have that x=8 and the statement 8>6 is true, therefore y get assigned to 4.
y=4.
Complete question:
y = (x > 6 ? 4:6); What will be the value of y if x = 8?