I have 3 students in a row and 5 grades for every student in a column.I needed the class average which i already found but i still need to find the average for individual student. I don't know how to begin and need help with that.
You ging in the right direction...
But i would make a single function to use for both averages:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
double calcAvg( int * arr , int size )
long sum =0;
for(int i =0;i<size;i++)
sum += arr[i];
return (sum / size);
double classAvg( int **arr , int rows, int columns )
long sum = 0;
for ( int i=0; i<rows;i++)
sum += calcAvg( arr[i] , columns );
return (sum / rows);
It is not tested...so if in doesn't work i am glad to help....