4.25 (computing ) You can approximate by using thefollowing series: = 4(1-1/3 +
ID: 3613560 • Letter: 4
Question
4.25 (computing ) You can approximate by using thefollowing series:= 4(1-1/3 + 1/5-1/7 + 1/9-1/11 + 1/13-.........- 1/(2i-1) +1/(2i+1) )
Display the value for i = 10000,20000,...... and 100000.
please help with this code , cuz i cannot proceed
this is my code
#include <iostream>
using namespace std;
int main()
{
int number;
double pi , series_neg = 0,series_pos = 0;
double j = 3;
cout <<"Enter the number ::";
cin >> number;
while(j <= number)
{
for(int i = 3; i <= number ;i++)
{
if((i % 2) != 0)
{
series_neg += (1/(2*j-1));
series_pos += (1/(2*j+1));
}
}
j++;
}
pi = (1 - (1/ ( series_pos + series_neg)));
cout <<"The value of pi is " << pi<<" ";
system("pause");
return 0;
}
Explanation / Answer
please rate - thanks be patient-it runs very slowly #include using namespace std; int main() { double pi, series_neg,series_pos; int i, j; for(j=10000;jRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.