#include #include #define NMAX 100 float func(float x); float funcd(float x); main() { float x0,dx,eps=1.0e-6; int i=0; printf("initial value ="); scanf("%f",&x0); while(fabs(dx)>eps){ i++; dx=-func(x0)/funcd(x0); x0=x0+dx; if(i>NMAX){ printf("not convergence"); break; } } printf("Iteration=%d x=%15.5f\n",i,x0); return(0); } float func(float x) { float y; y=x-3.0*exp(-x); return(y); } float funcd(float x) { float yd; yd=1.0+3.0*exp(-x); return(yd); }