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

1 Expert Approved Answer
Step: 1 Unlock

First lets take a moment to clarify the formula for the geometric mean Your description provides thi... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming Questions!