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:那位大哥告诉我怎样才能使输入 0 后程序终止In Reply To:那位大哥告诉我怎样才能使输入 0 后程序终止 Posted by:211211 at 2003-11-21 15:10:07 > #include<stdio.h> > #include<math.h> > void main(){ > int i; > float a ; <----这里加入一句话scanf ("%f",&a);就行了 > while (a!=0.00) { > scanf ("%f",&a); > int m=0; > float sum=0; > for (i=2;i<276;i++){ > if (sum<a) > sum+=float(1./i); > m+=1; > if (sum>=a) break; > } > printf("%d\n",m); > } > > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator