1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Fofino [41]
2 years ago
6

Write a C++ program to Calculate the value of π from the infinite series Print a table that shows the value of π approximated by

computing the first 200,000 terms of this series. How many terms do you have to use before you first get a value that begins with 3.14159?
Computers and Technology
1 answer:
nata0808 [166]2 years ago
3 0

The C++ program is an illustration of loops and conditional statements

<h3>How to analyze the infinite series</h3>

The infinite series is given as:

\pi = 4 - \frac 43 + \frac 45 - \frac 47 + \frac 49 -\frac 4{11} + ....

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

<h3>The main program</h3>

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:

brainly.com/question/24833629

You might be interested in
How are cars made in georgia
Talja [164]

Answer:

Its same everywhere.

7 0
4 years ago
Can you list one property of each of the following?<br> Excel<br> Word<br> Powerpoint
Rudiy27
Exel is used for graphing, Word for any type of essay or paper, and Powerpoint for presentations.
Hope this helps!
4 0
3 years ago
Read 2 more answers
In what way do coastal mountains affect a regions climate
Inessa [10]

Their climate's will differ because one is on the coast so winds off the ocean often prevent extremes of hot and cold. This coastal areas have mild marine climates, with relatively mild winters and cool summers, and the Mountain ranges in a path of prevailing winds affect precipitation on either side of a mountain.

3 0
3 years ago
Read 2 more answers
Entering the formula =SUM(C5:C18), in cell C19 will result in which of the following?
Greeley [361]
I am not sure what the 'following's are
but it should result the sum of all cells between and including C5 and C18.

5 0
3 years ago
Importance of good safe design
KengaRu [80]

Answer:

Safe design incorporates ergonomics principles as well as good work design. Good work design helps ensure workplace hazards and risks are eliminated or minimised so all workers remain healthy and safe at work.

Explanation:

Good work design, or safety in design, considers hazards and risks as early as possible in the planning and design process. It aims to eliminate or minimise the possibility of workplace injury or illness throughout the life of the product or process. ... products. layout and configuration

3 0
3 years ago
Read 2 more answers
Other questions:
  • Crowdsourcing is:
    5·1 answer
  • Which Command Prompt commands in Windows is used for listing a computer connections to shared resources
    10·1 answer
  • Chevening is looking for individuals with strong professional relationship building skills, who will engage with the Chevening c
    15·1 answer
  • A _____ describes two or more computers connected to each other.
    6·2 answers
  • How can computational thinking techniques be applied to software development
    6·1 answer
  • Match each statement from the passage with the message it represents.
    10·1 answer
  • How do you create a myBlueprint account
    11·2 answers
  • What methods do you use when researching a complicated or difficult subject? What tools are most useful to narrowing down and va
    12·1 answer
  • After you set a goal or purpose for your Web site, what is the next step to designing your​ pages​?
    13·1 answer
  • if a manager identifies numerous data integrity issues, she/he should consider the reports generated from that data as invalid a
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!