1 C 语言编程习题 第二章 习题2-2 5. 用二分法编程求 6x4 -40x2+9=0 的所有实根。 #include #include #define N 10000 double A,B,C; double f(double x) { return (A*x*x*x*x+B*x*x+C); } void BM(double a,double b,double eps1,double eps2) { int k; double x,xe; double valuea = f(a); double valueb = f(b); if (valuea > 0 && valueb > 0 || valuea <0 && valueb < 0) return; printf("Finding root in the range: [%.3lf, %.3lf]\n", a, b); for(k=1;k<=N;k++) { x=(a+b)/2; xe=(b-a)/2; if(fabs(xe)