Convert into a loop



cout << ave1 << endl;
cout << ave2 << endl;

return 0;
}
Last edited on
Exactly how Repeater showed you here.
http://www.cplusplus.com/forum/general/251954/

OP's original post for reference.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 #include<iostream>

using namespace std;

int main(){

int subject[2][3] = { {90,96,95}, {98,90,91} };


\\how to convert this using a loop:
float ave1 = (subject[0][0] + subject[0][1] + subject[0][2]) / 3.0f;
float ave2 = (subject[1][0] + subject[1][1] + subject[1][2]) / 3.0f;


cout << ave1 << endl;
cout << ave2 << endl;

return 0;
}


If you keep deleting your posts after you have your answer, expect people to not bother helping you.
Topic archived. No new replies allowed.