标签:
// 求1-1/2+1/3-1/4...+1/99-1/100 #include <stdio.h> int main() { double a = 1.0; int i; double sum = 1.0; for( i = 2; i <= 100; i++ ) { a = (-1) * a; sum = sum + a/i; } printf("1-1/2+1/3-1/4...+1/99-1/100=%f\n",sum); return 0; } <img src="http://img.blog.csdn.net/20150423114517322?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3lhcWlhbjU1Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
【c语言】求1-1/2+1/3-1/4...+1/99-1/100
标签:
原文地址:http://blog.csdn.net/zhaoyaqian552/article/details/45219715