Given the declarations below, which nested loop sums all of the elements in the array below please? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Given the declarations below, which nested loop sums all of the elements in the array below please?

int scores[3][3] = { {92, 87, 91}, {88, 72, 93}, {100, 94, 97} }; int sum = 0;

28th Apr 2017, 8:43 AM
H OLIVER
H OLIVER - avatar
2 Answers
+ 9
I think this might work: for(int I=0;I<3;I++) { for(int j=0;j<3;j++) { cout<<"\n"<<scores[I][j]; sum+= scores[I][j]; } } cout<<"\n"<<sum;
28th Apr 2017, 8:53 AM
Rahul George
Rahul George - avatar
+ 9
the solved programme will look something like this: https://code.sololearn.com/cEuja37PseFl/?ref=app
28th Apr 2017, 9:04 AM
Rahul George
Rahul George - avatar