Solved

Which of the Sets of Statements Below Will Add 1

Question 18

Multiple Choice

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?


A) if (x > 0) x++;
Else x--;
B) if (x > 0) x++;
Else if (x < 0) x--;
C) if (x > 0) x++;
If (x < 0) x--;
Else x = 0;
D) if (x == 0) x = 0;
Else x++;
X--;
E) x++;
X--;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions