Which of the sets of statements below will add 1 to x if x is - ProProfs Discuss
Topics
Products
Follow Us:

Which of the sets of statements below will add 1 to x if x is positive and subtract 1 from x if x is negative but leave x alone if x is 0?

This question is part of Computer Programming II Exam (Multiple Choice)
Asked by Justinsmith, Last updated: Mar 28, 2020

+ Answer
Request

1 Answer

justinsmith

Justinsmith

Answered Aug 28, 2018

If (x == 0) x = 0; else x++; x--;
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.