Ask Question

Var amount = 100;

var discount = 0;

if (amount>50)

discount = 0.1;

else if (amount > 75)

discount = 0.15;

else if (amount>100)

discount = 0.2;

else

discount = 0.25;

What is the value of discount?

0

0.1

0.15

0.2

+3
Answers (1)
  1. 16 June, 23:13
    0
    0.1

    Explanation:

    The value of amount is 100. So in the if-else-if ladder first condition in if will be checked since the amount is greater than 50 so the value of discount will become 0.1 and the execution of if else if ladder will be finish. The compiler will not be executing elseif or else. So the answer to this question is 0.1.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Var amount = 100; var discount = 0; if (amount>50) discount = 0.1; else if (amount > 75) discount = 0.15; else if (amount>100) discount = ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers