Question: Write a program that reads in positive floating-point numbers from standard input and prints their geometric and harmonic means. The geometric mean of n positive
Write a program that reads in positive floating-point numbers from standard input and prints their geometric and harmonic means. The geometric mean of n positive numbers x1, x2, ..., xn is (x1 - x2 - ... xn)1/n. The harmonic mean is n / (1/x1 + 1/x2 + ... + 1/xn). Hint : For the geometric mean, consider taking logarithms to avoid overflow.
Step by Step Solution
3.33 Rating (159 Votes )
There are 3 Steps involved in it
First lets take a moment to clarify the formula for the geometric mean Your description provides thi... View full answer
Get step-by-step solutions from verified subject matter experts
