Ask Question
22 April, 23:04

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.

+5
Answers (1)
  1. 22 April, 23:19
    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 & 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