Maybe something like this. Fill up a 5 element array and use its sum to calculate the average. Cycle around the elements subtracting the value at the current index from the sum and adding in the new temperature (and storing it at the current index). I just left it in an infinite loop for testing.

Code:

#include <stdio.h>
#define NumTempsToAvg 5
double GetTemp() {
printf("temp: ");
double d = 0.0;
scanf("%lf", &d);
return d;
}
void average() {
double temps[NumTempsToAvg];
double sum = 0.0;
for (int i = 0; i < NumTempsToAvg; i++) {
temps[i] = GetTemp();
sum += temps[i];
}
for ( ; ; ) {
for (int i = 0; i < NumTempsToAvg; i++) {
printf("avg: %f\n", sum / NumTempsToAvg);
sum -= temps[i];
temps[i] = GetTemp();
sum += temps[i];
}
}
}
int main() {
average();
}