作者在 2010-05-14 09:16:22 发布以下内容
#include<stdio.h>
void fun(float t)
{
double sum = 1.0;
double q = 1.0;
double x;
int n = 1;
while (q>=t)
{
q=q*(n/(2*n + 1));
sum += q;
n++;
}
{
double sum = 1.0;
double q = 1.0;
double x;
int n = 1;
while (q>=t)
{
q=q*(n/(2*n + 1));
sum += q;
n++;
}
x= sum/2;
printf("x = %f\n",x);
}
printf("x = %f\n",x);
}
void main(void)
{
float t;
{
float t;
printf("输入精度\n");
scanf("%d",&t);
fun(t);
}
scanf("%d",&t);
fun(t);
}