求助

17784757482 2024-07-08 18:18:58 12

60分的代码,还请 @root 及各位大佬查错(debug)

#include <bits/stdc++.h>
using namespace std;
int n, m;
float sum;
int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> m;
        sum += m;
    }
    cout << fixed << setprecision(4) << sum / n;
    return 0;
}
{{ vote && vote.total.up }}

共 2 条回复

17784757482

谢谢

root 站长

用 double, float 精度不够