Trouble with an RGB LED and accelorometer

Too complex you don't need arrays just do:-

{
 xValue =  yValue =  zValue = 0;
 for (byte i=0; i<AVERAGE_READINGS; i++){
   xValue += analogRead(Xpin);
   yValue  += analogRead(Ypin);
   zValues += analogRead(Zpin);
 }

xValue = xValue /AVERAGE_READINGS;
   yValue  = yValue /AVERAGE_READINGS;
   zValues = zValue /AVERAGE_READINGS;

As the analogue read is only 10 bits you will not overflow the value of the int until AVERAGE_READINGS is greater than 32. If you want more than this just make the readings a long int.