#include void main(){int i,n;double d=1,s=0;printf("输入n的值(n不小于8): ");scanf("%d",&n);for(i=1;i<=n;i++){s+=d/i;d=-d;}printf("s=%f",s);}