asked 197 views
2 votes
assume an int array, candy, stores the number of candy bars sold by a group of children wherecandy[j] is the number of candy bars sold by child j. Assume there are 12 children in all.Which of the following code could be used to compute the total number of bars sold by the children?a) for(int j=0; j<12; j++) sum+= candy[j];b) for(int j=0; j<12; j++) candy[j] = sum;c) for(int j=0; j<12; j++) sum = candy[j];d) for(int j=0; j<12; j++) sum += [j];e) for(int j=0; j<12; j++) [j] += sum;

asked
User Arien
by
8.2k points

2 Answers

5 votes

Answer:

it is A

Step-by-step explanation:

answered
User Jonathan Gleason
by
8.6k points
3 votes

Answer:

The first one. Important notice sum should be equal to zero before calculating the total sum.

answered
User Rockford Lhotka
by
7.7k points

No related questions found