Description
This article is from the Puzzles FAQ,
by Chris Cole chris@questrel.questrel.com and Matthew Daly
mwdaly@pobox.com with numerous contributions by others.
30 analysis/calculate.pi.p
How can I calculate many digits of pi?
analysis/calculate.pi.s
long a=10000,
b,
c=2800,
d,e,
f[2801],
g;
main()
{
for (;b-c;) f[b++]=a/5;
for (;
d=0,g=c*2;
c-=14, printf("%.4d",e+d/a), e=d%a)
for (b=c;
d+=f[b]*a,f[b]=d%--g,d/=g--,--b;
d*=b);
}
 
Continue to:
Share and Enjoy
Bookmark this story so others can enjoy it:
Tags
smart, self-help, motivation, puzzles