Double calulateAverage(double array[], int arrayLength){ double result = 0; for (int i = 0; i < arrayLength; i++){ result+= array[i]; } return result / arrayLength; }
#include <math.h> double calculateGeometricMean(double array[], int arrayLength){ double result = 1; for (int i = 0; i < arrayLength; i++){ result *= array[i]; } return pow(result, 1.0 /arrayLength); }
double result = 0;
for (int i = 0; i < arrayLength; i++){
result+= array[i];
}
return result / arrayLength;
}
#include <math.h>
double calculateGeometricMean(double array[], int arrayLength){
double result = 1;
for (int i = 0; i < arrayLength; i++){
result *= array[i];
}
return pow(result, 1.0 /arrayLength);
}