Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
改了,但还是错误,为什么呢?In Reply To:Re:为什么会出现Compile Error Posted by:tcxgsy at 2005-08-08 13:00:14 #define M 1001 #include"stdio.h" #include"math.h" double aver(int a[M],int m) { long sum=0; double aver; int i,j=0; for(i=1;i<=m;i++) sum+=a[i]; aver=sum/m; for(i=1;i<=m;i++) if(a[i]>aver) j++; m=(double)j/(double)m; return(m*100); } main() { int n,m,i; int a[M]; double d; scanf("%d",&n); while(n) { scanf("%d"&m); for(i=1;i<=m;i++) scanf("%d",&a[i]); d=aver(a,m); printf("%.3lf%c\n",d,'%'); n--; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator