Untitled
unknown
plain_text
7 months ago
547 B
1
Indexable
Never
#include<stdio.h> #include<math.h> float f (float x) { return(pow(x,2)-2*x-3); } int main() { float a,b,x,error; int i=0; printf("Enter allowed error"); scanf("%f",&error); printf("Enter a and b"); scanf("%f %f",&a,&b); do { ++i; x=(a*f(b)-b*f(a))/f(b)-f(a); printf("%d=%f\n",i,x); } while(fabs(f(x))>error); printf("\nRoot=%f",x); return 0; }
Leave a Comment