Which of the sets of statements below will add 1 to x if x is - ProProfs Discuss
Advertisement

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?

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?<br/>

Change Image    Delete

Asked by Justinsmith, Last updated: Dec 10, 2024

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

justinsmith

justinsmith

justinsmith
Justinsmith

Answered Aug 28, 2018

If (x == 0) x = 0; else x++; x--;
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

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