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:怎么还是不能停止,请再麻烦依次In Reply To:怎么还是不能停止,请再麻烦依次 Posted by:piaofushi919 at 2004-12-01 09:19:04 > #include <stdio.h> > #include <math.h> > void main(){ > float a,sum; > int n,c; <-- 先赋初值,比如a=1.0; > while (a!=0.00){ <-- 这里最好采用浮点比较 fabs(a)>1e-7 > scanf("%.2f",&a); > c=0; > sum=0; > for(n=2;n<67;n++){ > if(sum<a) > sum+=1/n; > c=c+1; > if(sum>a) > break; > } > printf("%d card(s)\n",c); > } > } > > 有一个 WARNING Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator