Question: Write a C program. The program allows the user to input as many doubles with a non-number to exit the loop. The program's job is

Write a C program. The program allows the user to input as many doubles with a non-number to exit the loop. The program's job is then to ouput the harmonic mean of the positive doubles in the list. No arrays are used in this program. An example of what the program should do is

if the list of doubles included {2.0, 3.0, 5.0, 7.0}

then the program should calculate 4/(1/2.0 + 1/3.0 + 1/5.0 + 1/7.0) and output it onto the screen

where 4 is the number of positive doubles and it is being divided by the sum of reciprocals of positive doubles in the list

Another example: Harmonic mean of {7, 7, 7, 7} is 7

All help is appreciated

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!