题解 | #求平均年龄#

求平均年龄

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;
}
全部评论

相关推荐

程序员牛肉:这一眼假啊,基本上都是骗人的,不然就涉及到职位贪腐了,就像之前华为的OD事件,看你运气好不好了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务