System.out.println(sum);
4. Write the conditional statement for the following decision-making situation: "Provided the value of y
is greater than 9, increase the value of y by 15, otherwise decrease the value of y by 36". using ternary operator
Answers
Answered by
3
Using Ternary Operator:
y += (y > 9) ? 15 : -36;
Explanation:
Provided the value of y is greater than 9 - (y > 9)
Increase the value of y by 15 - (y += 15)
Otherwise decrease the value of y by 36 - (y -= 36)
Similar questions