rewrite the following using ternary operator
If (x%2==0)
System.out.println("even");
else
System.out.println("odd");
please answer correctly
Answers
Answered by
3
Answer:-
Using ternary operator, we can write like this.
System.out.println((x%2==0)?"Even":"Odd");
Similar questions
Social Sciences,
3 months ago
English,
3 months ago
Social Sciences,
3 months ago
Hindi,
6 months ago
Math,
6 months ago
English,
11 months ago
Math,
11 months ago