题目要求计算平均数.
#include<iostream>
using namespace std;
int main() {
double sum=0.0,a;
int n=12;
while(n--) {
cin>>a;
sum+=a;
}
sum=sum/12;
cout<<"$"<<sum<<endl;
}
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1048
题目要求计算平均数.
#include<iostream>
using namespace std;
int main() {
double sum=0.0,a;
int n=12;
while(n--) {
cin>>a;
sum+=a;
}
sum=sum/12;
cout<<"$"<<sum<<endl;
}
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1048