Suppose that score is an int variable. Consider the following if statements:
if (score >= 90);
System.out.println("Discount = 10%");
a. What is the output if the value of score is 95? Justify your answer.
b. What is the output if the value of score is 85? Justify your answer.
1
Expert's answer
2020-11-20T14:24:11-0500
a. Output is "Discount = 10%"
b. Output is the same - "Discount = 10%"
println is not inside of the "if" operator scope (not included in curly brackets) so the "if" condition doesn't impact execution of println.
Comments
Leave a comment