Can this code be shortened using variables?

I went to the original code on the Adafruit page. I don't see any reason.

Let's prove it!

Try this:

  // take N samples in a row, with a slight delay
  int averageB = 0;
  for (i=0; i< NUMSAMPLES; i++) {
    int r = analogRead(oATemp);
    samples[i] = r;
    averageB += r;
    delay(10);
  }
  
  // average all the samples out
  average = 0;
  for (i=0; i< NUMSAMPLES; i++) {
     average += samples[i];
  }
  average /= NUMSAMPLES;
  averageB /= NUMSAMPLES;

  if (average != averageB) Serial.println("They didn't match!");