c语言 π/2=1+1/3*2/5+1/3*2/5*3/7+1/3*2/5*3/7*4/9+...求π精确到0.0001

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/21 09:24:10
c语言π/2=1+1/3*2/5+1/3*2/5*3/7+1/3*2/5*3/7*4/9+...求π精确到0.0001c语言π/2=1+1/3*2/5+1/3*2/5*3/7+1/3*2/5*3/7*

c语言 π/2=1+1/3*2/5+1/3*2/5*3/7+1/3*2/5*3/7*4/9+...求π精确到0.0001
c语言 π/2=1+1/3*2/5+1/3*2/5*3/7+1/3*2/5*3/7*4/9+...求π精确到0.0001

c语言 π/2=1+1/3*2/5+1/3*2/5*3/7+1/3*2/5*3/7*4/9+...求π精确到0.0001
double n,t,sum,pi;
sum=1.0;
n=1.0
t=1.0;
do{
t=t*(n/(2*n+1));
sum=sum+t;
}
while(n/(2*n+1)