x + = x++ + ++ x + --x + x; [ x = 5 ]
1. 29
2. 28
3. 26
4. 25
Please explain also how we get the answer for it
Answers
Answered by
9
Answer:
1)29
Explanation:
5+=5+7+6+6
Answered by
4
"Option 1: 29".
Explanation :
x + = x++ + ++ x + --x + x; [ x = 5 ]
Step 0:
First, take the right-hand side to perform the calculation. Keep the left-hand side value till last.
Value of left-hand side x =5.
Step 1:
x = 5 + (++x) + (--x) + x;
Step 2:
x = 5 + (++x) + (--x) + x;
x++ result is 5, but the variable ‘x’ value has been incremented to 6. so the next ‘x’ value is 6. Here next x value has increment in prefix. So now x value is 7.
x = 5 + 7 + (--x) + x;
Step 3:
Now x have minus in prefix which makes the value 7 to 6
x = 5 + 7 + 6+ x;
Step 4:
Finally, the x value is 6.
x = 5 + 7 + 6+ 6
x=24;
Step 5:
Now add both the right and left operand,
For left x value of x is 5 and the right operand x value is 24.
5+24=29
X=29.
Similar questions