The value for can be determined by the series equation pi

The value for _ can be determined by the series equation pi = 4 times (1 - 1/3 + 1/5- 1/7 + 1/9 - 1/11 + 1/13 -...) Write a program to approximate the value of _ using the formula given including terms up through 1/99.

Solution

#include<iostream.h>
#include<conio.h>

void main()
{
float sum;

for(int i=0;i<=49;i++)
{
if (i%2==0)
{
sum = sum + (1/(2i+1));
}
else
{sum = sum - (1/(2i+1));
}
}

sum = sum*4;
printf(\"The result of equation is %f\",&sum);

}

 The value for _ can be determined by the series equation pi = 4 times (1 - 1/3 + 1/5- 1/7 + 1/9 - 1/11 + 1/13 -...) Write a program to approximate the value of

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site