Question: Programs 1. Write a program to calculate arithmetic, geometric, and harmonic means of four integers. Prompt the user to enter four integers (must use data
Programs 1. Write a program to calculate arithmetic, geometric, and harmonic means of four integers. Prompt the user to enter four integers (must use data type int). Use a single scanf statement to read in the four numbers. a. Calculate the arithmetic mean (average) of the four numbers, noting that n represents the number of values and x, , x, , and x, are the four numbers. Assign the result to a float or double, avoiding integer truncation. arithmetic mean " .. b. Calculate the harmonic mean of the four numbers, again avoiding integer truncation harmonic _ mean = T-1--1 x, x c. Calculate the geometric mean of the four numbers. Use the math library function pow. This function may require that you cast the integers as data type double to enable the function to work. geometric-mean = r/x, * x," * x" Print the three means with two decimal digits
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
