Rewrite the following using ternary operator.
if( x%2==0)
System. out. println ("Even");
else
System. out. println ("odd");
Attachments:
Answers
Answered by
1
Answer:
(x%2==0)? System.out.println("Even"):System.out.println("Odd");
Explanation:
Hope it helps!!
Answered by
4
System.out.println(x % 2 == 0 ? "Even": "Odd");
Similar questions