题解 | #求平均年龄#
求平均年龄
http://www.nowcoder.com/practice/ca319fdb02714994850cc631d76f5547
#include <iostream>
using namespace std;
const int N = 105;
int a[N];
int n;
int main()
{
cin >> n;
for (int i = 0; i < n; ++i)
cin >> a[i];
double res = 0.0;
for (int i = 0; i < n; ++i)
res += a[i];
printf("%.2f", res / n);
return 0;
}