This is from yours,
V.VARADHA RAJAN
double Sma(double *nums, int n)
{
double total = 0;
int i;
for (i = 0; i < n; i++)
total += nums[i];
return total / n;
}
To change the function to calculate geometric mean just change it as
double Sma(double *nums, int n)
{
double total = 0;
int i;
for (i = 0; i < n; i++)
total *= nums[i];
return exp((1/n)*log(total));
}Please send comment on this mail.
[Non-text portions of this message have been removed]
