C++简洁代码:

平均身高

http://www.nowcoder.com/questionTerminal/b0e489a749f448e2b37f26ef56a76e58

C++简洁代码:

#include<bits/stdc++.h>
using namespace std;
int main() {
    float temp, res = 0;
    while(cin >> temp) res += temp;
    printf("%.2f",0.2 * res); //方法一,C语言
    //cout << setiosflags(ios::fixed) << setprecision(2); //方法二,c++
    //cout << 0.2 * res <<endl;
    return 0;
}
全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务