I had this question after viewing 2d array Grade Book.

```
int minimum (int scores[4] [3])
{
int min, i,j;
min = scores[0][0];
for ( i = 0; i<4; ++i )
for (j=0; j<3; ++j)
if ( scores[i][j] < min )
min= scores[i][j];
return min;
}
//function for Maximum Value
int maximum (int values[4][3])
{
int max, i,j;
max = values[0][0];
for ( i = 0; i<4; ++i )
for (j=0; j<3; ++j)
if ( values[i][j] > max )
max= values[i][j];
return max;
}
//function for Average
float average (int values[4][3])
{float sum=0.0;
int count=0;
float Average;
int i,j;
for(i=0;i<4;++i)
for(j=0;j<3;++j)
{
sum=sum+values[i][j];
++count;
}
Average=sum/count;
return Average;
}
//function to find student average
float studentavg (int values[4][3])
float finalmark;
finalmark=values[0][0];
{
for ( j=0;i<3;++j){
for( i=0;i<4;++i){
int rowsum=rowsum+values[i][j];
finalmark=rowsum/3;
printf("Student's final mark is %.2f\n", finalmark);
}
}
//Main Program
int main (void)
{
int values[4][3], i,j,min,max,sum=0,count=0;
float Average,finalmark;
int rowsum=0;
int minimum (int values[4][3]);
int maximum (int values[4][3]);
float average (int values[4][3]);
float studentavg (int values[4][3]);
printf ("Enter Values: \n");
for ( i = 0; i< 4; i++ ) {
for ( j = 0; j< 3; j++ ) {
printf(" values[%i][%i] = ", i,j, values[i][j] );
scanf("%i", &values[i][j]);
}
}
printf("\n");
printf("\n");
printf("\n");
min = minimum(values);
max = maximum(values);
Average = average(values);
finalmark=studentavg(values);
printf(" The minimum value is %i\n", min);
printf(" The maximum value is %i\n", max);
printf (" The Class final mark is %.2f\n", Average);
return 0;
}
}
}
```

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

```
#include <stdio.h> // you forgot to include this include
int minimum (int scores[4] [3])
{
int min, i,j;
min = scores[0][0];
for ( i = 0; i<4; ++i )
for (j=0; j<3; ++j)
if ( scores[i][j] < min )
min= scores[i][j];
return min;
}
//function for Maximum Value
int maximum (int values[4][3])
{
int max, i,j;
max = values[0][0];
for ( i = 0; i<4; ++i )
for (j=0; j<3; ++j)
if ( values[i][j] > max )
max= values[i][j];
return max;
}
//function for Average
float average (int values[4][3])
{float sum=0.0;
int count=0;
float Average;
int i,j;
for(i=0;i<4;++i)
for(j=0;j<3;++j)
{
sum=sum+values[i][j];
++count;
}
Average=sum/count;
return Average;
}
//function to find student average
float studentavg (int values[4][3])
{ // you forgot the {
float finalmark;
finalmark=values[0][0];
{
for ( int j=0;j<3;++j){ // you forgot to declare j as an int; replaced i with j
for( int i=0;i<4;++i){ // you forgot to declare i as an int
int rowsum=rowsum+values[i][j];
finalmark=rowsum/3;
printf("Student's final mark is %.2f\n", finalmark);
}
}
} //// I think you forgot a couple of }
} //// Hard to tell due to lack of consistent indentation
//Main Program
int main (void)
{
int values[4][3], i,j,min,max,sum=0,count=0;
float Average,finalmark;
int rowsum=0;
int minimum (int values[4][3]);
int maximum (int values[4][3]);
float average (int values[4][3]);
float studentavg (int values[4][3]);
printf ("Enter Values: \n");
for ( i = 0; i< 4; i++ ) {
for ( j = 0; j< 3; j++ ) {
printf(" values[%i][%i] = ", i,j, values[i][j] );
scanf("%i", &values[i][j]);
}
}
printf("\n");
printf("\n");
printf("\n");
min = minimum(values);
max = maximum(values);
Average = average(values);
finalmark=studentavg(values);
printf(" The minimum value is %i\n", min);
printf(" The maximum value is %i\n", max);
printf (" The Class final mark is %.2f\n", Average);
return 0;
}
// you forgot to get rid of these extra }
// } // probably due to lack of proper indentation
// }
```

(Also, when posting, use the code tags - hit the CODE button in the post to create the tags, and insert the code between the tags.)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
C++

From novice to tech pro — start learning today.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

int rowsum=rowsum+values[i][j]

You need the declaration of

rowsum out side the inner for loop and initialize it to 0.