# average(mean) of matrix

This is a discussion on average(mean) of matrix within the C Programming forums, part of the General Programming Boards category; hi everyone...hope somebody can help me on this. i'm suppose to find the average(mean) of 4 number entered. i have ...

1. ## average(mean) of matrix

hi everyone...hope somebody can help me on this.
i'm suppose to find the average(mean) of 4 number entered.
i have to use array...thax.

Code:
```void mean_matrix()
{
int iArrayFirst[4];
int i;
int mean;
int total;
total=0;

for(i=0;i<4;i++)
{
printf("enter value:");
scanf("%d", &iArrayFirst[i]);
}
printf("\n");
}
for(i=0;i<4;i++)
total=total + i;
mean=total/4;
}
}
}
printf("the mean is %d", mean);

}```

2. I am posting this because you did not use code tags on this thread. In the furture please use Code Tags. They make your code MUCH easier to read and people will be much more likely to help you if you do. And they'll be happier about helping you

For example:

Without code tags:

for(int i=0;i<5;i++)
{
cout << "No code tags are bad";
}

With Code Tags:
Code:
```for(int i=0;i<5;i++)
{
cout << "This code is easy to read";
}```
This is of course a basic example...more complicated code is even easier to read with code tags than without.

I've added code tags for you this time. They can be added by putting [code] at the beginning of your code and [/code] at the end. More information on code tags may be found on the code tag post at the top of every forum. I also suggest you take a look at the board guildlines if you have not done so already.

This is a common first post mistake, just remember to use [code] tags in the future and you'll get much more help.

If this is your first time posting here the welcome, and if there's anything I can do or any questions I can answer about these forums, or anything else, please feel free and welcome to PM me.