Ask Question
27 November, 18:25

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.

+1
Answers (1)
  1. 27 November, 19:34
    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?
Find an answer to your question ✅ “Considering the following code segment: if (num ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers