Answer to Question #202428 in C++ for Master j

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. 



1
Expert's answer
2021-06-02T16:18:49-0400
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog