149k views
1 vote
Using the same 3 integers, output the average and product, using floating-point arithmetic.

Output all floating-point numbers with five digits after the decimal point, which can be achieved as follows:
Put x to output with 5 decimal places

Ex: If the input is:

10 20 5

1 Answer

5 votes

To find the average and product of the three integers 10, 20, and 5, add them together and divide by 3 for the average, and multiply them for the product. The average is 11.66667 and the product is 1000, both formatted with five decimal places.

To calculate the average of three integers, you add the integers together and divide the sum by 3. For the product, you multiply the three integers together. When the input integers are 10, 20, and 5, the calculations are as follows:

To find the average:

Add the numbers: 10 + 20 + 5 = 35

Divide by the number of integers: 35 / 3 = 11.66667

To find the product:

Multiply the numbers: 10 * 20 * 5 = 1000

The average is 11.66667, and the product is 1000. When outputting these results with five decimal places, the average is shown as 11.66667 and the product as 1000.00000.

User Ivan Denysov
by
7.9k points