Ask Question

What is the value of variable num after the following code segment is executed?

var num = 10;

while (num <10)

{

num = num + 1;

}

+1
Answers (1)
  1. 12 February, 08:22
    0
    num=10

    Explanation:

    Initial value of variable "num" is 10. When while loop execute for the first time, it checks the condition (num<10) and founds this FALSE. So the statement inside the while loop will not be executed. If while loop doesn't execute then it will not going to change the value of "num". That is why the value of "num" will remain same i. e. num=10.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is the value of variable num after the following code segment is executed? var num = 10; while (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