大佬帮忙看看为什么运行不了
查看原帖
大佬帮忙看看为什么运行不了
1182991
jgdlkfjg楼主2023/11/1 23:25

大佬帮忙看看为什么运行不了

#include<stdio.h>
#include<math.h>

double s(int n){
   int i,s;
   s=0.0;
   for(i=1;i<=n;i++)
   {
       s=s+(1/i);
   }
   return s;
}

int main()
{
   int a,k;
   k=0;
   scanf("%d",k);
   a=1;
   while(s(a)<k)
   {
       a=a+1;
   }
   printf("%d",a);

}
2023/11/1 23:25
加载中...