shuoshao @ 2017-03-25 14:22:35
#include "stdio.h"
int main ()
{
int k,i;
double s=0;
scanf ("%d",&k);
for (i=1; ;i++)
{
s+=1.0/i;
if (s>k)
{
printf ("%d\n",i);
return 1;
}
}
return 0;
}
by 张仪 @ 2017-03-25 15:25:33
啊,这样你程序返回值是1了啊
by wanglt20010309 @ 2017-04-30 16:01:43
把return 1改成return 0就好啦
你是想先无限循环,达成条件就终止循环,return 0就好啦