Ask Question
2 June, 20:13

Considering the following code segment:

if (num <0) {

alert ("It's a negative num.");

}

else {

alert ("It's a non-negative num.");

}

What will be displayed if num=0?

It's a positive num.

It's a non-negative num.

It's a zero.

Nothing will be displayed.

+4
Answers (1)
  1. 2 June, 23:47
    0
    It's a non-negative num.

    Explanation:

    As the value of num=0 is given in the input. First it will check "if (num<0) " condition,

    here this condition false. Then it will check "else" condition and give an alert as

    "It's a non-negative num.". In there is "if-else" condition given, only one of them

    will be executed based on their TRUE value.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Considering the following code segment: if (num ...” 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