How about?
int averageReading = 0;
for (int n = 0; n < numReadings; n++) averageReading += getvoltage(temperaturePin);
averageReading /= numReadings;
Does that make sense? I'd change the getvoltage() function to just return a temp and put the math that converts the voltage into a temp in there.