0

Pls why is the answer 16

x = 8; y = 7; x++(x changes to 9) x += y--(therefore x = 9 + 6) so pls can someone tell me how the answer is 16 tho :( what did i miss out

9th Aug 2020, 4:41 AM
kefas Destiny
kefas Destiny - avatar
6 Réponses
+ 5
y is 7, not 6.
9th Aug 2020, 5:27 AM
Rowsej
Rowsej - avatar
+ 3
You called y before decrementing. Your answer could give 15 if your last statement was: x += --y
9th Aug 2020, 5:55 AM
Rawley
Rawley - avatar
+ 3
kefas Destiny y-- is post decrement so first it will assign the value then Decrement by 1. So here y-- will be 7 and after assigning y will be 6 x = x + y-- = 9 + 7 = 16 and finally y = 6
9th Aug 2020, 6:04 AM
A͢J
A͢J - avatar
+ 2
But y was decremented🤔
9th Aug 2020, 5:38 AM
kefas Destiny
kefas Destiny - avatar
0
x = 8; y = 7; x++ // x=9 x += y--//x=9+7 -> x=16
9th Aug 2020, 7:58 PM
Donka Tanina
0
Oh thanks ya'll i see it now
10th Aug 2020, 6:43 AM
kefas Destiny
kefas Destiny - avatar