Rewrite the following program segment using if-else
statements instead of the ternary operator. (2)
String grade=(marks>=90)? “A” : (marks>=80)? “B” : “C”;
Answers
Answered by
2
Answer:
Here, condition is a boolean expression. It returns either true or false.
if condition evaluates to true, statements inside the body of if are executed
if condition evaluates to false, statements inside the body of if are skipped
2. “Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stup id.” — Albert Einstein
“ Tapping into genius is simple in theory yet hard in practice. It comes from mastering the one activity you love most .”
3. “A life spent making mistakes is not only more honorable, but more useful than a life spent doing nothing.” — George Bernhard Shaw
“Experiments are necessary for the experiences that create growth and new opportunities
Similar questions