C++求平均年龄_ios
C++求平均年龄_C语言_02

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

int main()
{
	int men;
	cin >> men;

	double n = 1.0,sum = 0.0,age = 0.0;
	while (n <= men) {
		cin >> age;
		sum += age;
		n += 1;
	}
	double avg = sum / men;
	cout << fixed << setprecision(2) << avg << endl;

	return 0;
}