Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

One numerical algorithm to compute an approximation to the constant involves computing the value of the following sum. where the value N controls the number

image text in transcribed
One numerical algorithm to compute an approximation to the constant involves computing the value of the following sum. where the value N controls the number of steps (and larger values will result in better approxima- tions). Recall from the labs that a numerical summation like the one above can be implemented with a C for or vhile loop (using extra variables inside the loop to break down the formula into manageable parts) 2.1 Your Task Write a syntactically and semantically correct C program which uses the formula above to compute several different approximations of using the formula above for N = 10. 100. 1000. 1000, 100000 and 1000000. Notice that at each step, the value of N is multiplied by 10. Your code should be stored in a file called pi.c". To receive full marks, your code should contain as little duplication as possible (and, in particular, should not contain more than one copy of the loop which evaluates the formula above). You will likely need to use nested loops to accomplish this task 3 The approximation computed at cach step should be output to 12 decimal places. The output of your program will be the following n10: Approxination is 3.142425985001 n 100: Approximation is 3.141600986923 n 1000: Approximation is 3.141592736923 n 10000: Approxication 1s 3.141592654423 n 100000: Approxisation is 3.141592653598 n 1000000 : Approximation is 3.141592653590

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Evaluate the importance of diversity in the workforce.

Answered: 1 week ago

Question

Identify the legal standards of the recruitment process.

Answered: 1 week ago