Ask Question
22 April, 09:39

Write a statement that increments numUsers if updateDirection is 1, otherwise decrements numUsers. Ex: if numUsers is 8 and updateDirection is 1, numUsers becomes 9; if updateDirection is 0, numUsers becomes 7. Hint: Start with "numUsers

+2
Answers (1)
  1. 22 April, 10:01
    0
    Following are the statement is given below

    if (updateDirection = =1) / / check condition

    {

    ++numUsers; / / increments the value

    }

    else

    {

    --numUsers; / / decrement the value

    }

    Explanation:

    Following are the description of statement

    Check the condition in the if block. If the "updateDirection" variable is 1 then then control moves to the if block otherwise control moves to the else block statement. In the if block the statement is "++numUsers" it means it increment the value by 1. In the else block the statement is "--numUsers" it means it decrement the value by 1.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a statement that increments numUsers if updateDirection is 1, otherwise decrements numUsers. Ex: if numUsers is 8 and updateDirection ...” 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