Evaluate the following expressions, if a=b++ + b where b = 10
Answers
Answered by
1
Answer:
21
Explanation:
The initial value of `b` is given to us as 10.
Expression given:
a=b++ + b
In the given equation, since the "++" is after the variable `b`, the value of `b` will be taken as it is (i.e. 10) then it'll be incremented by one after the expression `b++`.
(If it were `++b` it value would've incremented first by 1 then used in the equation.)
So now the equation becomes:
a=10 + 11(since the value of `b` is now incremented by 1)
Therefore the value 21 is stored in the variable `a`.
Overlook:
Expression Value of `b`
a=b++ + b 10
a=10 + b 11
a=10 + 11 11
a=21 11
Similar questions