Challenge: Exact Average

Lab C Beginner 10 points

Read three whole numbers and print their average with 2 decimals.

Input

Three integers.

Output

Average: X.XX

Example

Input

1 2 4

Output

Average: 2.33
Sample input available Sample output available
Editor
C

Hints

Dividing by 3 (an int) would cut off the decimals.

Divide by 3.0, or use a (double) cast.

Solution explanation

Using 3.0 makes it a decimal division, so the answer keeps its decimal part.

Show solution
#include <stdio.h>

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    printf("Average: %.2f\n", (a + b + c) / 3.0);
    return 0;
}
Output
Answer
HOME LABS COMMUNITY DASHBOARD