Challenge: Average of Three

Lab C++ Beginner 10 points

Read three whole numbers and print their average with exactly 2 decimal places.

Input

Three integers separated by spaces.

Output

One line: Average: and the average, like Average: 3.67.

Example

Input

2 4 5

Output

Average: 3.67
Sample input available Sample output available
Editor
C++

Hints

(a + b + c) / 3 is integer division! Divide by 3.0 instead.

#include <iomanip> and use fixed << setprecision(2).

Solution explanation

Dividing by 3.0 makes it a decimal division. fixed + setprecision(2) always shows two decimal places.

Show solution
#include <iostream>
#include <iomanip>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    double average = (a + b + c) / 3.0;
    cout << fixed << setprecision(2) << "Average: " << average << "\n";
    return 0;
}
Output
Answer
HOME LABS COMMUNITY DASHBOARD