Hello!
I am having a problem in this program.In it a have to calculate the value of π from the infinite series
π=4-4/3+4/5-4/7+4/9-4/11+.....
by using this formula i have to print a table that shows the approximate value of π after each
of the first 1,000 terms of this series.
But the code i have written is having problems and do not gives the required results. Can any one
help? I'll be thankful
#include<iostream.h>
#include<conio.h>
void main()
{
float pi=4;
double i,j,a=3,b=5;
cout<<"The value of pi :"<<endl;
for(i=1;i>-1;i++)
{
for(j=1;j>-1;j++)
pi=pi-4/a+4/b;
a+=4;
b+=4;
if(i==1000||i==i*1000)
cout<<pi<<endl;
}
getch();
}