标签:double
#include<stdio.h>
int main()
{
int i = 0;
double num = 0.0;
int flag = 1;
for (i = 1; i <= 100; i++)
{
num += (1.0 / i)*flag;
flag = -flag;
}
printf("%lf", num);
system("pause");
return 0;
}
1-1/2+1/3-1/4+...........+1/99-1/100的值
标签:double
原文地址:http://10942013.blog.51cto.com/10932013/1720069