Respuesta :
The C++ program is an illustration of loops and conditional statements
How to analyze the infinite series
The infinite series is given as:
[tex]\pi = 4 - \frac 43 + \frac 45 - \frac 47 + \frac 49 -\frac 4{11} + ....[/tex]
The above series shows that, the addition and the subtraction signs are interchanged, and the denominator of the fractions increase by 2 while the numerator remains the same
The main program
The program written in C++, where comments are used to explain each line is as follows:
#include <iostream>
using namespace std;
int main(){
//This initializes the value of pi to 0
double pi = 0;
//This iterates from 1 to 200000
for(int i = 0; i< 200000; i++){
//The following conditions determine the value of pi
if(i%2==0){
pi+=4.0/(1.0+2.0*i);
}
else{
pi-=4.0/(1.0+2.0*i);
}
}
//This prints the value of pi
cout<<pi;
return 0;
}
Read more about loops and conditional statements at:
https://brainly.com/question/24833629