你觉得要用啥种语言呢?
#include
int main(){
int i,j,n,t=0;
float s=0;
scanf("%d",&n);
for(i=1;i<=n;i++){
t+=i;
s+=1.0/t;
}
printf("%f\n",s);
return 0;
}
#include
main()
{
double s;
int i,t=0,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
t+=i;
s+=1.0/t;
}
printf("%lf",s);
}
以经测试过了可用;如果你用的是TC编程的话请在最后加 getch();