Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I NEED TO CODE SOMETHING IN CLION. I WAS WONDERING IF ANYONE COULD HELP ME WITH THAT. I WILL PUT A PHOTO BELOW THIS IN
I NEED TO CODE SOMETHING IN CLION. I WAS WONDERING IF ANYONE COULD HELP ME WITH THAT. I WILL PUT A PHOTO BELOW THIS IN CASE ANYONE KNOWS HOW TO CODE IN CLION.
Approximating One numerical algorithm to compute an approximation to the constant involves computing the value of the following sum. N-1 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 while loop (using extra variables inside the loop to break down the formula into manageable parts) 2.1 YourTask 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, 10000, 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. The approximation computed at each step should be output to 12 decimal places. The output of your program will be the following n- 10: Approximation is 3.142425985001 n- 100: Approximation is 3.141600986923 n - 1000: Approximation is 3.141592736923 n - 10000: Approximation is 3.141592654423 n - 100000: Approximation is 3.141592653598 n - 1000000: Approximation is 3.141592653590Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started