Write a function, called calcAvgTemp, that accepts TWO (2) arguments in its parameter: a floating-point array, and a value representing the size for the floating-point array. Your solution must calculate the average of the values found in the array, and then return the result as a floating-point value.
float calcAvgTemp(float arr[], int size)
{
double s = 0.0;
for (int i=0; i<size; i++) {
s += arr[i];
}
return s / size;
}
Comments
Leave a comment