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]
3 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]3 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
How do you change a LAN (local area network) to a WAN (wide-area network)
ahrayia [7]

Answer:

Go to internet, click use as LAN under the cable section and click yes to confirm

4 0
3 years ago
When sensing nonverbal communication, the listener candetermine happiness, fear, and sadness primarily from______body movementge
lilavasa [31]

Answer: Eyes and face

Explanation: The non-verbal communication defines the communication through the facial expression gesture, posture etc. This type of communication happens where there is no requirement or permission of being verbal or just to judge a person without having communication with them .The expression obtained from face are enough to determine the emotion of a person whether he/she is happy, sad or scared.

7 0
3 years ago
Source code is one particular representation of a software system. It highlights some details and hides others. This is a good e
grigory [225]

Answer:

Abstraction

Explanation:

Under fundamental principles of software engineering, the term "abstraction" is simply defined as the act of highlighting some details and hiding other ones.

Thus, the correct answer among the options is Abstraction.

8 0
3 years ago
Andrew is researching a new operating system for the computers at his workplace. His boss wants the computers to be able to conn
Bumek [7]

Answer:

Windows 8.1 Core

Explanation:

In this particular example, we're going to use Windows 8.1 Core, is the most basic of the window's family, in this case, only we need an OS to connect the hardware with the cloud computing for security and is not necessary another license, in addition, Windows 8.1 core is easiest to use, is so friendly with the user.

6 0
3 years ago
Complete the divisible_by(list1, int1) function below. As input, it takes a list of integers list1 and an integer int1. It shoul
damaskus [11]

Answer:

The function is as follows:

def divisible_by(listi, n):

   mylist = []

   for i in listi:

       if i%n == 0:

           mylist.append(i)

   return mylist

   pass

Explanation:

This defines the function

def divisible_by(listi, n):

This creates an empty list

   mylist = []

This iterates through the list

   for i in listi:

This checks if the elements of the list is divisible by n

       if i%n == 0:

If yes, the number is appended to the list

           mylist.append(i)

This returns the list

   return mylist

   pass

5 0
2 years ago
Other questions:
  • If you quote an author from a website in a paper, it will be important to create a _____ in your writing to give them credit for
    7·2 answers
  • Read the excerpt below and answer the question.
    14·1 answer
  • Ranges of IP address that anyone can use for their internal networks are known as ______.
    8·2 answers
  • False when you tap or click the ‘decrease font size’ button, excel assigns the next lowest font size in the font size gallery to
    13·1 answer
  • In a database, __________ is used to uniquely identify each record for retrieval or manipulation. answer an attribute or a field
    7·1 answer
  • Just forgot where she saved a certain file on her computer therefore she searched for all files with jpg file extension which ty
    13·2 answers
  • Jonathan works with a team of graphic designers. They have a collection of images and have divided the image editing work among
    5·2 answers
  • In which situation is coauthoring of presentations primarily utilized?
    9·1 answer
  • Write program to read 10 random numbers, then find how many of them accept division by 4,
    6·1 answer
  • Have y’all enjoyed The new hero floryn from Mobile legends
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!