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
Kazeer [188]
4 years ago
15

Write a C++ program that computes an approximation of pi (the mathematical constant used in many trigonometric and calculus appl

ications) to four decimal places. A summation that can be used to compute pi is the following (from calculus). pi = 4/1 - 4/3 + 4/5 - 4/7 + 4/9 - ....... + (-1)ⁿ * 4/ (2n+1)Your program will compute a sequence of computations: S₀ = 4/1 S₁ = S₀ - 4/3 S₂ = S₁ + 4/5Since the above sequence So, S1, S2, ... converges to pi, we can stop when two consecutive S values differ by less than 0.00005.
Computers and Technology
1 answer:
Verizon [17]4 years ago
3 0

Answer:

#include <iostream>

#include<cmath>

using namespace std;

int main()

{

double total = 0;

double check=1;

double ct=0;

double old=1;

while( fabs(total - old) > 0.00005 )

{

old=total;

total=total+check*4.0/(2.0*ct+1);

ct=ct+1;

check=0.0-check;

}

cout<<"Approximate value of pi is "<<total<<endl;

return 0;

}

Explanation:

  • Initialize all the necessary variables.
  • Run a while loop until the following condition is met.

fabs(total - old) > 0.00005

  • Inside the while loop calculate the total value.
  • Lastly, display the approximate value of pi.
You might be interested in
What type of security software prevents, detects, and removes malware that tries to collect personal information or change compu
Lesechka [4]
Antivirus? I think is the correct answer
4 0
3 years ago
Which of the following describes evolution in the SDLC model?
stira [4]

Completing the requirements analysis is the evolutionary step of the Software development life cycle (SDLC). Hence option 3

<h3>What is the software development life cycle?</h3>

The SDLC is a method for evaluating and improving the development process. It enables a fine-grained study of each process phase. As a result, firms are able to maximize efficiency at each level.

SDLC aids in the achievement of these objectives by detecting inefficiencies and increased costs and resolving them so that everything runs smoothly.

Thus, Initial needs and architecture planning must be completed and are considered as an evolution in the SDLC model

Learn more about SDLC:

brainly.com/question/26366977

#SPJ1

4 0
2 years ago
HTML tags normally come in pairs like and The end tag is written like the start tag, but with a backward slash inserted before t
baherus [9]

Answer:

<bold> Hm ok, what is the question? </bold>

4 0
4 years ago
A Windows user is attempting to exit a locked up desktop application that is not responding to mouse or keyboard input. Which of
Kamila [148]

Answer:

Open Task Manager and end the process associated with the application.

Explanation:

When using a computer installed with the Windows Operating system and an application is not responding to the mouse or keyboard input, you can end such application process without exiting other open applications by opening the task manager using the key combinations "CTRL + ALT + DEL". This would open the Task Manager showing all the open application and then you can end the process associated with the application that is not responding.

3 0
3 years ago
Why doesn't brainly give me 15 questions a day
Lilit [14]
I’m not sure how to answer that
8 0
3 years ago
Read 2 more answers
Other questions:
  • Suppose in a class of 100 students, there is a homework due every week. The professor wants to encourage students to hand in the
    8·1 answer
  • A(n) _____ is a type of computer crime perpetrator whose primary motive is to achieve financial gain.
    5·1 answer
  • The piece of hardware that contains the circuitry that processes the information coming in to the computer and tells the other h
    8·1 answer
  • 2. Name the three building blocks of design that pertain to form.
    7·1 answer
  • What are some reasons a person might choose to remain anonymous on the Internet?
    12·2 answers
  • Which statement is LEAST accurate? Select one: a. A common reason for ERP failure is that the ERP does not support one or more i
    14·1 answer
  • Let A and B be two stations attempting to transmit on an Ethernet. Each has a steady queue of frames ready to send; A’s frames w
    7·1 answer
  • I need help with this question!!
    8·1 answer
  • "Businesses around the world all need access to the same data, so there needs to be one type of information system that is desig
    13·1 answer
  • Complete the sentence with the correct response.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!