Try this;
static void Main(string[] args)
{
const int cpt = 153;
const int taille = 20;
const double X = 21.5;
const double Y = -1.98;
const double Z = 1100.0;
double [] Barycentre_x = new double [cpt];
double [] Barycentre_y = new double [cpt];
double [] Barycentre_z = new double [cpt];
Random rand = new Random();
for (int n=0; n < cpt; ++n)
{
Barycentre_x[n] = X + (rand.NextDouble()-.5) * Math.Abs(X)/100.0;
Barycentre_y[n] = Y + (rand.NextDouble()-.5) * Math.Abs(Y)/100.0;
Barycentre_z[n] = Z + (rand.NextDouble()-.5) * Math.Abs(Z)/100.0;
}
const int groupes = cpt / taille;
double [] Moy_bar_x = new double[groupes];
double [] Moy_bar_y = new double[groupes];
double [] Moy_bar_z = new double[groupes];
int index = 0;
for (int g = 0; g< groupes; ++g)
{
Moy_bar_x[g] = Moy_bar_y[g] = Moy_bar_z[g]= 0.0;
for (int n=0; n<taille; ++n, ++index)
{
Moy_bar_x [g] += Barycentre_x [index];
Moy_bar_y [g] += Barycentre_y [index];
Moy_bar_z [g] += Barycentre_z [index];
}
Moy_bar_x[g] /= taille;
Moy_bar_y[g] /= taille;
Moy_bar_z[g] /= taille;
}
for (int g = 0; g < groupes; ++g)
{
Console.WriteLine("Moy_bar = ({0},{1},{2})", Moy_bar_x[g], Moy_bar_y[g], Moy_bar_z[g]);
}
}