makeway @ 2024-08-09 20:42:50
#include<bits/stdc++.h>
using namespace std;
int main()
{
int b;
double c=0,d;
cin>>b;
double a[b];
for(c;c<=b;c++){
cin>>a[b];
d+=a[b];
}
cout<<fixed<<setprecision(2)<<d/b<<endl;
return 0;
}
by makeway @ 2024-08-09 21:01:50
@GoodLuckCat 谢谢大佬
by 13307661995cyf @ 2024-08-17 15:51:14
@makeway
#include<bits/stdc++.h>
using namespace std;
int main(){
int b;
double c=0,d=0;
cin>>b;
double a[b+1];
for(c;c<b;c++){
cin>>a[b];
d+=a[b];
}
cout<<fixed<<setprecision(2)<<d/b<<endl;
return 0;
}
by Jason101 @ 2024-08-20 18:54:47
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
double a , b , c = 0;
cin >> n;
for(int i = 1;i <= n;i++)
{
cin >> a;
c = c + a;
}
double s = c / n;
printf("%.2lf",s);
return 0;
}