Advertisements
Advertisements
Question
Given: x + = x++ + ++ x + − − x
Find the value, when x = 5.
Options
23
21
22
24
MCQ
Solution
23
Explanation:
The expression is calculated as follows:
x = x + (x++ + ++x + --x) (x = 5)
x = 5 + (5 + ++x + --x) (x = 6)
x = 5 + (5 + 7 + --x) (x = 7)
x = 5 + (5 + 7 + 6) (x = 6)
x = 5 + 18
x = 23
shaalaa.com
Is there an error in this question or solution?