solve the given output y+=y+++y--+--y when y=8
Answers
Answered by
1
y = 32 (final answer)
Because:
y += y++ + y-- + --y (y = 8)
y = y + y++ + y-- + --y (y = 8)
y = 8 + y++ + y-- + --y (y = 8)
y = 8 + 8 + y-- + --y (y = 9)
y = 8 + 8 + 9 + --y (y = 8)
y = 8 + 8 + 9 + 7 (y = 7)
y = 32
The bracketed value of y is given for informal reference. The actual program execution does NOT occur in the above way, and the above is provided just for you to understand.
Similar questions