Write a C++ program using a while loop to calculate the value of ?/2 accurate to
ID: 3677459 • Letter: W
Question
Write a C++ program using a while loop to calculate the value of ?/2 accurate to 6 digits after the decimal point using the following series:
Can someone please help me with the set up for this problem? I'm not sure where to being here. Any help is much appreciated!
B) Write a C++ program using a while loon to calculate the value of /2 accurate to 6 digits after the decimal point using the following series: 2 3 3-5 3-5.7 Display the following and turn in printouts of the program and the results The number of terms needed to find /2 .The value of T/2 using acos-1)/2 using 10 digits after the decimal point. . The value of T/2 found with the series using 10 digits after the decimal point (the first 6 digits after the decimal point should match the value above).Explanation / Answer
#include <iostream>
#include <iomanip>
int main()
{
int num=1,den=3,c;
double sum;
sum= 1+1/3;
//setting precision to 10
std::cout << std::fixed << std::setprecision(10) << sum;
c=2;//setting count=2 why because we have count for sum value 1,1/3 terms
double d=(acos(-1)/2);
//setting exact precision 10 i.e value after point is 10 digits
std::cout << std::fixed << std::setprecision(10) << d;
while(d==sum)
{
for(i=2;i<=c;i++)
{
num=num*(num+1);
den=den*(den+2);
}//for
sum=sum+(num/den);
c++;
}//while
cout << "The number of terms needed to pi/2 is "<<c;
}//main
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.