Maybe you can break it down like this
Count the numbers, say n

multiply all the numbers together to 
, say product


then find nth root using pow( product,1/n) . 


if u compile from a shell put -lm to link the math library.
Lawal.O





________________________________
From: Bill Cunningham <[email protected]>
To: [email protected]
Sent: Tuesday, July 28, 2009 8:45:56 PM
Subject: Re: [c-prog] Re: geometric mean

  

----- Original Message ----- 
From: "peternilsson42" <peternilsson42@ yahoo.com>
To: <c-p...@yahoogroups. com>
Sent: Monday, July 27, 2009 9:13 PM
Subject: [c-prog] Re: geometric mean

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.

I know how to calculate the geometric mean by hand or calc but it is 
coding it that I'm at a bit of a loss here. Multiply n number of numbers and 
find the n root of the total multiplied. No problem there.

Bill


   


      

[Non-text portions of this message have been removed]

Reply via email to