又是一个求助帖,先谢过了
#include<stdio.h>#include<conio.h>
int main()
{
int n,i;
float sum=0;
printf("please input a number:");
scanf("%d",&n);
if(n<=0)
printf("a positive is needed!\n");
for(i=1;i<=n;i++)
{
sum=sum+1/i;
}
printf("%f",sum);
getch();
return 0;
}
个人找不出错在哪儿?