C Program for Calculating Pi - Calculation Views : 282
Tagged in : Calculation
0 0
Send mail

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);}
By Geethalakshmi, On - 2010-01-04



    Login to add Comments .