Ask Question

Ar count = 10;

while (count>0)

{

count = count - 2;

}

What is the value of count after the code segment above is executed?

+5
Answers (1)
  1. 8 July, 19:05
    0
    The value of count after the code is executed is 0

    Explanation:

    According to the code initially the value of count is 10

    while (count>0)

    {

    count=count-2

    }

    means 10>0 condition is true

    count=10-2=8

    Again 8>0 condition of while loop is again true

    now count becomes=6

    This process repeated untill the condition of while loop is true

    and at last count becomes 0 the condition is false (0>0) so count becomes 0 after the code segment is executed
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Ar count = 10; while (count>0) { count = count - 2; } What is the value of count after the code segment above is executed? ...” 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