Ask Question
13 July, 07:42

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. 13 July, 10:44
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers