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 |
Re:我的用C写的为什么总是在输入数据时总是输入13次呢,不应该的啊。那个大哥大姐帮帮忙看一下吧In Reply To:我的用C写的为什么总是在输入数据时总是输入13次呢,不应该的啊。那个大哥大姐帮帮忙看一下吧 Posted by:prehacker at 2009-10-20 09:39:34 > #include<stdio.h> > main() > { > float monthmoney[13],sum=0,average=0; > int i; > > for(i=0;i<12;i++) > { > scanf("%f\n",&monthmoney[i]);/*这一行运行的时候怎么总是让输入13个数据呢*/ > } > for(i=0;i<12;i++) > { > sum=sum+monthmoney[i]; > } > average=(float)sum/12; > printf("%.2f",average); > } 你SCANF的时候不要加\N! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator