求π值的C语言程序。

如题所述

第1个回答  2013-12-16
#include <stdio.h>
#include <math.h>
void main()
{
int s=1;
float n=1,pi=0, t=1;
while(fabs(t)>=0.000001)
{pi+=t; <br/>n+=2; <br/>s=-s; <br/>t=s/n; <br/>}
pi*=4;
printf("pi=%f\n",pi);

}
第2个回答  2013-12-16
# include <stdio.h>
# include <math.h>
main()
{
int s;
float n,t,pi;
t=1;
pi=0;
n=1;
s=1;
{pi=pi+t;<br/>n+=2;<br/>s=-s;<br/>t=s/n;<br/>}
pi*=4;
printf("pi=%f\n",pi);
}
第3个回答  2013-12-16
没看到你有什么内容呀,什么求TT值的C语言程序

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网