Ask Question
30 January, 00:56

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

+1
Answers (1)
  1. 30 January, 01:28
    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 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