If x = 15, y = 6 , z = 30. Then evaluate the following
++y + y++ + z % x++ + ++x
Answers
Answered by
1
Given,
x=15,y=6,z=30
To evaluate:
- ++y + y++ + z % x++ + ++xx
Solution:-
++y +y++ +z% x++ + ++x
>>>7 + 7 + 30% 15 +17. //Now y is 8 and x is 17
>>>7+7+0+17
>>>31. <= Correct Answer
Explaination:-
- The explaination is very easy ....you just need to understand the concept of Prefix (++x ) and Postfix (x++) increment.
- Prefix increment means first increase then calculate....i.e. First the value will increase then the control moves futher.
- Postfix increment means first calculate then increase.....i.e. First the control moves futher then the value increases.
Therefore, the correct answer is 31.
Similar questions
Biology,
1 month ago
History,
1 month ago
Economy,
3 months ago
India Languages,
9 months ago
India Languages,
9 months ago