Question #202428

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. 



Expert's answer

float calcAvgTemp(float arr[], int size)
{
    double s = 0.0;
    for (int i=0; i<size; i++) {
        s += arr[i];
    }


    return s / size;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS