Rewrite the following using ternary operator.
if( x%2==0)
System. out. println ("Even");
else
System. out. println ("odd");
Attachments:
Answers
Answered by
5
System.out.println(x % 2 == 0 ? "Even": "Odd");
Similar questions
Accountancy,
2 months ago
Political Science,
2 months ago
English,
2 months ago
English,
4 months ago
Geography,
4 months ago
English,
10 months ago
Math,
10 months ago