Which of the answers does the same thing as the following: value += sum++;
Advertisements
Question
Which of the answers does the same thing as the following:
value += sum++;
Options
value = value + sum;sum = sum + 1;sum = sum + 1;value = value + sum;value = value + sum;value = value + ++sum;
MCQ
Advertisements
Solution
value = value + sum; sum = sum + 1;
Explanation:
The statement value += sum++; first adds the original value of sum to value and then increments sum by 1.
shaalaa.com
Is there an error in this question or solution?
