第1个回答 2013-11-09
#include <stdio.h>
long a=10000,b,c=2800,d,e,f[2801],g;
void main()
{
for(;b-c;) f[b++]=a/5;
for(;d=0,g=c*2;c-=14,printf("%04d",e+d/a),e=d%a)
for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);
}本回答被网友采纳
第2个回答 2013-11-09
#include<stdio.h>
#include<math.h>
void main()
{
int s;
float n,t,pi;
t=1;pi=0;n=1.0;s=1;
while(fabs(t)>1e-6)
{
pi=pi+t;
n=n+2;
s=-s;
t=s/n;
}
pi=pi*4;
printf("pi=%lf\n",pi);
}