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
For a project called "The Sheep Market", Aaron Koblin collected drawings of sheep from strangers on the Internet. He posted the
Furkat [3]

Answer:

Aaron could expect a diversity in the style of the sheep drawings.

Explanation:

Crowdsourcing is a simply a sourcing model in which an individual or organizations get goods and services, ideas and finances, from a large, relatively open and often rapidly growing group of internet users.

It makes it easier for participants to achieve a cumulative result through working differently on the same project. That is to say, it provides work between participants to achieve a cumulative result.

Its benefits is that, Crowdsourcing allows businesses to perform tasks more quickly than when a single employee is working alone. Again, Breaking up a project into a collection of smaller pieces and providing these pieces to a larger group of workers hastens the completion of projects. Overall, crowdsourcing presents a more efficient way to do work.

From the Question, Aaron was able to get different pictures of sheep in their numbers also because he used crowsourcing on amazon.

He got a variety of pictures and so many in such a short time for his project "The Sheep Market".

6 0
3 years ago
Imagine that a crime has been committed and being a police officer you have to investigate the case. Solving a crime can be a ve
Igoryamba

Explanation:

On October 31, around twelve o'clock at night, the lights were dull. It was Siberian cold and I was walking painfully under the whitish lighting of a lamppost and the retro neon lights of a convenience store in a neighborhood that was buzzing when I went to buy meat. buildings, grayish in this half-light, crumbled under the weight of sleep, while the neighborhood was still open. Its decoration was particularly macabre in tone: synthetic but very sticky spider webs adorned the porches of the terraces, pumpkin ornaments are exhibited like works of art, ... Some pushed the macabre by hanging mannequins made up in corpses. At the entrance to the neighborhood, I found the body of its owner stabbed. Frozen in place, I wondered what else awaits me. My heart was pounding, feeling a shiver of anguish. When I was removing the phone from my pocket to call my police friends, my hands were clenched in fear. An investigation was carried out to find out the causes of death. Also, I went with them so they take my words. Hopefully the murderer will be arrested to put an end to this sybilinous crime.

4 0
3 years ago
C program how to input this? ​
Neporo4naja [7]
Chchvjvcuvggiiog. Correct
3 0
2 years ago
Explain why the fundamental software engineering principles of process, dependability, requirements management, and reuse are re
Georgia [21]

These principles are not explicit to one kind of program and are increasingly broad "best practice" rules that assist designers with composing code that is easier to maintain.

<u>Explanation:</u>

A set of programming guidelines that are executed to play out a particular undertaking according to the prerequisites of the client is known as programming. Every product has some essential standards to follow. In light of all product frameworks have basic quality traits, including accessibility, modifiability, execution, security and wellbeing, testability and ease of use, the key programming thoughts give basic arrangements or strategies to help those characteristics.

It is generally less expensive, over the long haul, to utilize programming designing strategies and methods for programming frameworks instead of simply compose the projects as though it was an individual programming venture.

8 0
3 years ago
What file type starts at offset 0 with a hexidecimal value of ffd8?​?
kiruha [24]
The answer is jpeg.  It is <span>file type that starts at offset 0 with a hexidecimal value of ffd8?.  JPEG stands for </span>Joint Photographic Experts Group.  It is a popular image file format,  commonly used by digital cameras to store photos<span>. The format also supports different levels of compression, which makes it ideal for web graphics.</span>
5 0
3 years ago
Other questions:
  • Which of the following is 1000 of a second​
    15·1 answer
  • For your new sporting goods store, you originally planned to only sell Nike shoes. Therefore, you only had enough shoe displays
    11·2 answers
  • Dylan, an interior designer, has sketched out a layout for a client's living room. He wants the client's approval of the layout
    11·2 answers
  • A browser is used for creating Web pages. true or false?
    5·2 answers
  • Clearing the computer's cache helps store recently-used information.
    8·1 answer
  • A recommended cleaner for the bowls of coffee brewers is
    7·1 answer
  • What are three sections in a work sheet accounting
    12·1 answer
  • We cannot imagine a life without the Internet. Imagine that you had to live without being connected to the Internet. Discuss the
    9·1 answer
  • Which job qualifications are typical for someone who wants to work in Information Support and Services?
    8·2 answers
  • College entrance requirements are the expectations for admission.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!