C Program for Calculating Pi

by Geethalakshmi 2010-01-04 21:19:56

C Program for Calculating Pi


Here is a 160 character program in C, written by D. T. Winter, which will calculate the first 800 digits of pi:

int 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*a,

f=d%--g,d/=g--,--b;d*=b);}

Tagged in:

826
like
0
dislike
0
mail
flag

You must LOGIN to add comments