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
Alexxandr [17]
3 years ago
10

Approximation of PI: [50 marks] Write a C program that computes an approximation of pi (the mathematical constant used in many t

rigonometric and calculus applications) to four decimal places. A summation that can be used to compute pi is the following (from calculus).
Engineering
1 answer:
ANTONII [103]3 years ago
4 0

Answer:

#include <iostream>

#include <cmath>

#include <iomanip>

using namespace std;

double piValue() {

       double p = 1;

       int i = 1;

       while(true) {

               double prev = p;

               p += pow(-1, i) * (1.0 / (1 + 2*i));

               if(abs(prev - p) < 0.00005) {

                       break;

               }

               i++;

       }

       return 4*p;

}

int main() {

       cout << piValue() << endl;

}

**************************************************

You might be interested in
Airtight plugs are installed in the ends of large sizes of PVC conduit during bending to_____________.
Lana71 [14]

Airtight plugs are installed in the ends of large sizes of PVC conduit before bending to  A. prevent the conduit from collapsing when heated.

<h3>What is Airtight plugs?</h3>

Airtight plugs is necessary in the  PVC conduit so as to be able to avoid the collapse of conduit.

In this case, Airtight plugs are installed in the ends of large sizes of PVC conduit before bending to  A. prevent the conduit from collapsing when heated.

Learn more about Airtight plugs on:

brainly.com/question/20704252

#SPJ1

7 0
2 years ago
Calculate the mean piston speed, bmep, and specific power of: (a) the spark-ignition engines in Figs. 1.11 and 1.13 at their max
Kisachek [45]

Answer:

Explanation:

See the attached picture for detailed answer.

5 0
4 years ago
(2) Explain why stainless steel is more corrosion resistant in many environments than plain carbon steel.
gavmur [86]

Answer:

<h3>I think it is because the more chromium that is added,the more stable the passive layer becomes.</h3>

Explanation:

<h2>#Princesses Rule</h2>
3 0
2 years ago
true or false modeling is making predictions about future data points not associated with your equation? Explain why.​
Lelechka [254]

Answer:

Explanatiomn:

3 0
4 years ago
All welding processes that take place without melting of the work pieces. a)- True b)-False
Advocard [28]

Answer: False

Explanation: Welding process is the joining process of two metals in which they are melted using the heat and then cooling it down and fuse them.Base metal is the melted and then some filler substance is added in the metal  and then kept for the fusion process so that joining can be done. Therefore like fusion welding includes the process of melting work piece , so the statement in the question is false.

6 0
3 years ago
Other questions:
  • What does the following program segment do? Declare Count As Integer Declare Sum As Integer Set Sum = 0 For (Count = 1; Count &l
    15·1 answer
  • provides steady-state operating data for a solar power plant that operates on a Rankine cycle with Refrigerant 134a as its worki
    12·1 answer
  • A six-lane divided highway (three lanes in each direction) is on rolling terrain with two access points per mile and has 10- ft
    7·1 answer
  • A 4140 steel shaft, heat-treated to a minimum yield strength of 100 ksi, has a diameter of 1 7/16 in. The shaft rotates at 600 r
    13·2 answers
  • A piece of corroded metal alloy plate was found in a submerged ocean vessel. It was estimated that the original area of the plat
    8·1 answer
  • . A two-dimensional fluid motion is represented by a point vortex of strength Γ set at distance c from an infinite straight soli
    10·1 answer
  • In sleep, what does REM stand for?
    10·1 answer
  • A customer got debited twice, how would you investigate and resolve this conflict on the customer side and on the company side?
    5·1 answer
  • Two semiconductor materials have exactly the same properties except material A has a bandgap energy of 0.90 eV and material B ha
    12·1 answer
  • According to the rules of dimensioning, how should the written notes appear?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!