"Bill Cunningham" <bill...@...> wrote:
>
>  double Sma(double *nums, int n)
> {
>     double total = 0;
>     int i;
>     for (i = 0; i < n; i++)
>         total += nums[i];
>     return total / n;
> }
> 
> I want to take this function a step further and have it
> calculate a geometric mean. But I have no idea where to
> start. Any ideas?

Start with the definition of geometic mean!

If you already know that it's the nth root of the product
of the n values, then surely the only difficult thing is
calculating the nth root. But there's a simple function in
<math.h> that will do that for you.

-- 
Peter

Reply via email to