Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Fill in the blanks to the code to make it work One formula to calculate the appr

ID: 653168 • Letter: F

Question

Fill in the blanks to the code to make it work


One formula to calculate the approximate value of pi is given below: y = 1/2 + (1/2 * 3/4) + (1/2 * 3/4 * 5/6) + (1/2 * 3/4 * 5/6 * 7/8) + (Xi * 2 * (i + 1) - 1 / 2 * (i + 1) if Xi+1 = Xi * The code below is developed based on the formula, and it continue on adding until the last item is smaller than 10-5. Fill the blanks to make the code work. #include int main() { doble s = 0, t = 0.5; int n; for (___; t>=le-2;n++) { s=s+t; ___ } printf("y=%f ",___); return 0; }

Explanation / Answer

int t1 = 1

for (t = t1*t;t>=1e-2;n++) // to perform t = 1/2*3/4

{

s = s+t;

t1 = t;

t = (2*n - 1)/2*n;// n is number of terms

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote