Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
#include<stdio.h> int main() {int i,k=1; double sum=0.0; for(i=1;i<=100;i++) {sum=sum+k*1.0/i; k=-k;}
printf( " %lf",sum); return 0;
}
@150930 这样计算,虽然语句少,但结果会有很大的误差。我觉得应该按照分数的形式计算,最后再将分数形式的结果转变为小数,或者就返回分数形式的结果。