Computer Science, asked by anushkadebnath524, 2 months ago

a+=a++ - ++b + a. where a =4 and b = 8​

Answers

Answered by kamalrajatjoshi94
0

Answer:

int a=4,b=8;

a+=a++ - ++ b + a

=4+(4-9+5)

=4+0

=4

Steps how it executed:-

variable a and b is initialised

a+=b

a=a+b

So,

a=4+(a++ - ++b +a)

Now,in a post increment is there so a remains same but the final value of a is 5.

a=4+(4- ++b +a)

Now,in pre increment b gets incremented and the final value is the incremented value so b becomes 9

a=4+(4-9+a)

Now,since final value of a is 5 so a=5

a=4+(4-9+5)

On solving we get:-

a=4+0

=4

Similar questions