Question. 5
What is the value of y after evaluating the
expression y = y++ + y++ + - -y + ++y; when
int y=6?
Answers
Answered by
0
Answer:
Suggestions
Make sure all words are spelled correctly.
Try different keywords.
Try more general keywords.
Try fewer keywords
Explanation:
pls mark a brain liest
Answered by
1
Answer:
- The value of y is - 28
Step By Step Solution:
Given that,
int y = 6;
>> y = y++ + y++ + --y + ++ y
>> y = 6 + y++ + --y + ++y (y is 6 due to post-increment)
>> y = 6 + y++ + --y + ++y (y becomes 7 after increment)
>> y = 6 + 7 + --y + ++y (y is 7 due to post-increment)
>> y = 6 + 7 + --y + ++y (y becomes 8)
>> y =6 + 7 + 7 + ++y (y becomes 7 due to pre-decrement)
>> y = 6 + 7 + 7 + 8 (y becomes 8 due to pre-increment)
Adding up, we get,
>> y = 6 + 14 + 8
>> y = 20 + 8
>> y = 28
Hence, the final value of y is 28.
Similar questions
Math,
2 months ago
Computer Science,
2 months ago
Math,
4 months ago
English,
10 months ago
Math,
10 months ago