Question: C programming int calculateSum(int arr[], int size) { int i, sum = 0; for (i = 0; i < NUM_OF_ELEMENTS; i++) { sum += arr[i];

C programming

int calculateSum(int arr[], int size) { int i, sum = 0; for (i = 0; i < NUM_OF_ELEMENTS; i++) { sum += arr[i]; } return sum; }

Call the function calculateAverage() to calculate and return the average of all the elements in the array as a float. calculateAverage() will call calculateSum() to aid in calculating the average (calculated sum / NUM_OF_ELEMENTS). Output the returned average in main() with 2 places of precision (2 places to the right of the decimal point [%.2f]).

float calculateAverage(int arr[], int size)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!