56.c
来自「计算概论阅读材料」· C语言 代码 · 共 22 行
C
22 行
#define M 1000#include <stdio.h>#include <math.h>void main(void){ double x,d,eps; int m=0; printf("input x eps\n"); scanf("%lf %lf",&x,&eps); do{ d=(((2*x+4)*x-5)*x-8)/((6*x+8)*x-5); /*d=(2*x*x*x+4*x*x-5*x+8)/(6*x*x+8*x-5)*/ x=x-d; m++; if(fabs(x)>1) d=d/x; }while((fabs(d)>eps)&&(m<M)); if(m<M) printf("x=%.12lf\n",x); else printf("calculation times is over than %d",M);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?