Output Questions for Class 10 ICSE Computer Applications
Rewrite the following using ternary operator:
if (x % 2 == 0)
System.out.println("Even");
else
System.out.println("Odd");
Java
Java Operators
ICSE 2016
101 Likes
Answer
System.out.println(x % 2 == 0 ? "Even" : "Odd");
Answered By
62 Likes