YOUNGER_Chen @ 2023-11-25 09:29:05
#include<iostream>
using namespace std;
int main(){
int a,n;
double sum=0;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a;
sum+=a;
}
cout<<sum/n;
return 0;
}
by ragwort @ 2023-11-25 09:30:49
@YOUNGER_Chen 你没有保留两位小数
by ragwort @ 2023-11-25 09:32:47
@YOUNGER_Chen 你可以用
cout << fixed << setprecision(小数位数) << 变量名 << endl;
或者
printf("%.小数位数lf",变量名);
by YOUNGER_Chen @ 2023-11-25 09:56:55
@wind_kaka 跟我说谢谢你因为有你温暖了四季