题解 | #求平均年龄#
求平均年龄
https://www.nowcoder.com/practice/ca319fdb02714994850cc631d76f5547
#include <iostream> using namespace std; int main() { int n; double sum = 0; while(scanf("%d", &n) != EOF){ int age; for(int i = 0; i < n; i++){ scanf("%d", &age); sum += age; } printf("%.2f\n", sum / n); } } // 64 位输出请用 printf("%lld")