Computer Science, asked by kingshukdey98, 5 months ago

if a = 5,b=10 then, find the value of
a+=a++ - b-- + --b + a
plzz no spam !! write correct answer

Answers

Answered by prabhas24480
2

Answer ⤵️

Firstly, let us see the difference between ++a , −−a , a++ and a−− .

++a is pre-increment, meaning increase first, then use.

−−a is pre-decrement, meaning decrease first, then use.

a++ is post-increment, meaning use first, then increase.

a−− is post-decrement, meaning use first, then decrease.

Now coming to the query:

Initially a=5

b=(++a)+(−−a)+(a−−)+(++a)

Step 1: ++a : Value of a is first increased, then used, ie, ++5=6 . First place value is 6 , and now a=6 .

Step 2: −− a : Value of a is first decreased, then used, ie, −−6 =5 . Second place value is 5 , and now a=5 .

Step 3: a−− : Value of a is first used, then decreased, ie, 5−− =5 . Third place value is 5 , and now a=4 .

Step 4: ++a : Value of a is first increased, then used, ie, ++4=5 . Fourth place value is 5 , and now a=5 .

Placing respective values in equation:

b=6+5+5+5

b=21

Similar questions