8. Given this code: //This a code to determine the root of a function //The function is (cosx+2)/3 #include #include float root(float); int main() { float a[100],b[100],c=100.0; int i=1,j=0;...


8.<br>Given this code:<br>//This a code to determine the root of a function<br>//The function is (cosx+2)/3<br>#include<stdio.h><br>#include<math.h><br>float root(float);<br>int main()<br>{<br>float a[100],b[100],c=100.0;<br>int i=1,j=0;<br>b[0]=(cos(0)-3*0+1);<br>printf(0.00001) { a[j+1]=root(a[j]); c=a[j+1]-a[j]; c=fabs(c); //fabs = Absolute Value of Floating-Point Number j++; } printf("\n The root of the given function is %f",a[j]); } float root(float x) { "/>
Extracted text: 8. Given this code: //This a code to determine the root of a function //The function is (cosx+2)/3 #include #include float root(float); int main() { float a[100],b[100],c=100.0; int i=1,j=0; b[0]=(cos(0)-3*0+1); printf("\nEnter a beginning guess:\n"); scanf ("%f",&a[0]); while(c>0.00001) { a[j+1]=root(a[j]); c=a[j+1]-a[j]; c=fabs(c); //fabs = Absolute Value of Floating-Point Number j++; } printf("\n The root of the given function is %f",a[j]); } float root(float x) {
float y;<br>y=(cos(x)+2)/3;<br>return y;<br>}<br>Modify the code to demonstrate (print out, show) each of the values of the iteration<br>before the final root is determined.<br>

Extracted text: float y; y=(cos(x)+2)/3; return y; } Modify the code to demonstrate (print out, show) each of the values of the iteration before the final root is determined.

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here