Write a program that reads in positive floating-point numbers from standard input and prints their geometric and
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 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.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction To Programming In Java An Interdisciplinary Approach
ISBN: 9780672337840
2nd Edition
Authors: Robert Sedgewick, Kevin Wayne
Question Posted: