| ||||||||||
| 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:Re:怎么还是不能停止,请再麻烦依次 Posted by:bobpkuhj at 2004-12-01 10:08:05 > <-- 先赋初值,比如a=1.0;
那样的话,还是不停止。 我是这样改的, 可就是停止不了,
#include <stdio.h>
#include <math.h>
void main()
{
float a,sum;
int n,c;
scanf("%f",&a);
while (a>0.00){
sum=0;
c=0;
for(n=2;n<67;n++){
if(sum<a){
sum+=(float)1/n;
c++;
}
if(sum>a)
break;
}
printf("%d card(s)\n",c);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator