← Variables & Types

Average of Three Measurements

easy

Read three floating-point measurements and print their average, rounded to exactly 2 decimal places, in the form:

Average: 2.00

Two things to watch for. First, scanf and printf use different format specifiers for the same type: reading a double needs %lf, but printing one uses %f (the l is only meaningful to scanf, which needs to know how many bytes to write into). Second, divide by 3.0, not 3 – dividing by the integer literal 3 still produces a correct result here because at least one operand (a + b + c) is already a double, so the whole expression promotes to floating-point before the division happens. It’s worth being deliberate about it anyway.

Your solution

"Run" uses the sample stdin ("1.0 2.0 3.0"). "Submit" checks your code against all 3 test cases.

Test results

Submit your solution to run it against all test cases.

Hints

    Reference solution