Problem Statement - if-else to ternary operator
Rewrite the following using ternary operator :
if(x%2 == 0)
System.out.print(“EVEN”);
else
System.out.print(“ODD”);
Solution
sunmitra| Created: 31-Mar-2018 | Updated: 16-Apr-2019|ICSE2016
Rewrite the following using ternary operator :
if(x%2 == 0)
System.out.print(“EVEN”);
else
System.out.print(“ODD”);
sunmitra| Created: 31-Mar-2018 | Updated: 16-Apr-2019|ICSE2016