asked 36.1k views
3 votes
What is sum after the following loop terminates? int sum = 0; int item = 0; do { item ; sum = item; if (sum > 4) break; } while (item < 5);

2 Answers

6 votes

Sorry i don’t know the answer

answered
User Kirschstein
by
8.6k points
4 votes
int sum = 0;
int item = 0;
do
{
item;
sum = item;
if (sum > 4)
break;
} while (item < 5);


You will generate a compile error, as having (item;) as a statement on its own is invalid.
answered
User Simonluca Landi
by
7.5k points