Finding average readings on ADXL335

First of all; I'm very new to working with arduino and coding in general, so please bear with me..

What I want to do is make arduino read a number of analog values, add them together and finally divide the accumulated sum by the number of readings and thus display the result (as the average of the readings).

I'm expecting a result somewhere near 512, however result I get is about 20 times larger.

The code I'm using:

const int xpin = A1;                  // x-axis of the accelerometer

long accsum = 0;

void setup()
{
  
  Serial.begin(9600);

  
  analogReference(EXTERNAL);

  pinMode(xpin, INPUT);
  
  for(int i = 0; i < 100; i++){
    accsum=accsum + analogRead(xpin);
    delay(5);
  }
  Serial.print('accsum/i');
}

void loop()
{  
}
  Serial.print('accsum/i');

When you use single-quotes like that you get character codes.

I think what you want is:

Serial.print(accsum/100);

You probably can't use (accsum/i) because your defied 'i' inside the loop. When the loop is done that variable no longer exists. You know the value you want to divide by so just use the constant.