176k views
1 vote
What message will be displayed after the execution of the following code segment?

var BMI = 18;

if(BMI>18.5)

alert( "Overweight");

else

alert("Underweight");

Overweight

Underweight

Both Overweight and Underweight

randomly display either Overweight or Underweight.

User Dave Satch
by
6.2k points

1 Answer

4 votes

Answer:

The correct answer for the given question is "Underweight"

Step-by-step explanation:

As the code is written in javascript , we see that var BMI hold the value 18,so In the if block we check the condition "18>18.5 " this condition is false so it executed the else block i.e it print " Underweight" .

So the correct answer for the following code is " Underweight"

User Shane Holloman
by
6.7k points