Ask Question
23 May, 23:53

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

+4
Answers (1)
  1. 24 May, 01:38
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers