Computer Applications
Rewrite the following program segment using if-else statements instead of the ternary operator:
c = (x >= 'A' && x<= 'Z') ? "Upper Case Letter" : "Lower Case Letter";
Java
Java Operators
47 Likes
Answer
if (x >= 'A' && x <= 'Z')
c = "Upper Case Letter";
else
c = "Lower Case Letter";
Answered By
31 Likes
Related Questions
Rewrite the following using ternary operator:
if (x % 2 == 0) System.out.println("Even"); else System.out.println("Odd");
Rewrite the following program segment using if-else statements instead of the ternary operator:
s = (a + b < c || a + c <= b || b + c <= a) ? "Triangle is not possible": "Triangle is possible";
Rewrite the following using ternary operator:
if (bill > 10000) discount=bill*10.0/100; else discount=bill*5.0/100;
Rewrite the following program segment using if-else statements instead of the ternary operator:
net = (salary > 10000) ? salary - (8.33/100)*salary : salary - (5/100)*salary