比较

实现四舍五入

http://www.nowcoder.com/practice/020a0cf673174d5795d97ae79cff59a0

        //        

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
    double min = 100, max = 0, num = 0, x;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        if (max < x)
            max = x;
        if (min > x)
            min = x;
        num += x;
    }
    cout << fixed << setprecision(2) << max << " " << fixed << setprecision(2)  << min << " " << fixed << setprecision(2) << num / n << endl;
    system("pause");
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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