int i,n;double sum=0;scanf("%d",&n);for(i=1;i<=n;i++){ sum+=1./n;}printf("%lf\n",sum);
把他答案的 sum+=1./n;改成 sum+=1./i;