4. Write a function called mean that will return the average value of an integer array. The...
Question:
4. Write a function called mean that will return the average value of an integer array. The integer array and its length must be passed to the function as parameters.
5.Write a function called max that will return the index of the max value of an integer array. The integer array and its length must be passed to the function as parameters.
E.g. array = {1,2,3,4,5,6,7,8,9,0}
max = 9
index = 8
6.Write a function called variance that calculates and returns the variance of an array that is passed to it as a parameter. Also, pass the length of the array as a parameter.
variance = mean(array^2) - (mean(array))^2
array^2 = square of each element of the array
You must use the mean function above in your calculation.
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis