Science, asked by YOGESHmalik025, 4 months ago

Give the output ;-

If a=5 , b = 12

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

Find a and b ​

Answers

Answered by Anonymous
2

Answer:

If a=5 & b=(++a) +(--a) +(a--) +(++a), then what is the output and how is it possible?

Affordable postgraduate degrees in the German capital of Berlin.

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

Good night hope your all dreams comes true...

Me your sis ayesha.. :) ☺️☺️

Answered by Anonymous
13

Answer

ɪɴ ᴄ++, ᴛʜᴇ ᴄᴏᴍᴘɪʟᴇʀ ᴡɪʟʟ ᴇxᴇᴄᴜᴛᴇ ᴛʜᴇ ᴛʜᴇ ɢɪᴠᴇɴ ꜱᴛᴀᴛᴇᴍᴇɴᴛ ʀɪɢʜᴛ ᴛᴏ ʟᴇꜰᴛ ʙᴇᴄᴀᴜꜱᴇ ɪꜰ ᴍᴜʟᴛɪᴘʟᴇ ɪɴᴄʀᴇᴍᴇɴᴛ ᴀɴᴅ ᴅᴇᴄʀᴇᴍᴇɴᴛ ᴏᴘᴇʀᴀᴛᴏʀꜱ ᴀʀᴇ ᴜꜱᴇᴅ ɪɴ ᴀ ꜱɪɴɢʟᴇ ᴇxᴘʀᴇꜱꜱɪᴏɴ ᴛʜᴇɴ ᴛʜᴇ ʀɪɢʜᴛᴍᴏꜱᴛ ᴏᴘᴇʀᴀᴛɪᴏɴ ɪꜱ ɢɪᴠᴇɴ ʜɪɢʜᴇꜱᴛ ᴘʀɪᴏʀɪᴛʏ.

ꜱᴏ, ᴛʜᴇ ᴇxᴇᴄᴜᴛɪᴏɴ ᴡɪʟʟ ʙᴇ ꜰʀᴏᴍ ʀɪɢʜᴛᴍᴏꜱᴛ ᴀɴᴅ ᴛʜᴇ ʀɪɢʜᴛᴍᴏꜱᴛ (++ᴀ)=6, ᴛʜᴇɴ ᴛʜᴇ (ᴀ--)=6 (ʙᴇᴄᴀᴜꜱᴇ ᴏꜰ ᴘᴏꜱᴛ ᴅᴇᴄʀᴇᴍᴇɴᴛ), ᴀɴᴅ ᴛʜᴇɴ (--ᴀ)= 4, ᴀɴᴅ ꜰɪɴᴀʟʟʏ ᴛʜᴇ ʟᴇꜰᴛ ᴍᴏꜱᴛ (++ᴀ)=5.

ᴛʜᴜꜱ ᴛʜᴇ ꜰɪɴᴀʟ ᴀɴꜱᴡᴇʀ ᴡɪʟʟ ʙᴇʙ

= 21.

Similar questions