jiangjun12345 @ 2024-07-29 21:30:14
using namespace std; int main(){ int i,n; float s,x; cin>>n; for(i=1;i<=n;i++){ cin>>x; s=s+x; } s=s/n; printf("%.4f",s); return 0; }
by Grammar__hbw @ 2024-07-29 21:31:28
希望更丰富的展现?使用 Markdown、KaTeX。
by Ke9_qux @ 2024-07-29 21:34:48
小数点后两位,您写的是.4f
by Mr_yang1 @ 2024-07-29 21:36:50
#include<bits/stdc++.h>
using namespace std;
int main(){
double n,s=0,ds;
cin>>n;
for(int i=1;i<=n;i++){
cin>>ds;
s+=ds;
}
printf("%.2f",s/n);
}
by jinrunsen @ 2024-08-21 15:19:46
#include<bits/stdc++.h>
using namespace std;
int main(){
int i,n;
double s,x;
cin>>n;
for(i=1;i<=n;i++){
cin>>x;
s=s+x;
}
s=s/n;
printf("%.2f",s);
return 0;
}
by jinrunsen @ 2024-08-21 15:22:33