Question: Write a C/C++ function called average(...) which takes an array of ints and the array's length as arguments and returns the average (mean value) of
Write a C/C++ function called average(...) which takes an array of ints and the array's length as arguments and returns the average (mean value) of the array's values. Note: You can use your code from Q1 to help test your function. E.g. Calling the following code from main() should print the value 5.5. You only need to submit the code for your average(...) function in the box below.
// Your initArrayNatural() and average() function code here
int main() { int arr[10]; int size = sizeof(arr) / sizeof(int); initArrayNatural(arr, size); cout << "Average of array values is = " << average(arr, size); // should print 5.5 }
Step by Step Solution
There are 3 Steps involved in it
The question youve provided is complete and relates to a programming task in CC that involves writing a function to calculate the average of an array ... View full answer
Get step-by-step solutions from verified subject matter experts
