#include #include void main() { int n,m, s; double p, tow=0.00001 , ty, itm, x , orig, y; clrscr(); printf("give me the maximum item of Tayer polynomial-->"); scanf("%d",&m); printf("give me the real number for computing Tayer polymonial -->"); scanf("%lf",&x); orig=log(x); printf("ln(%lf)=%lf\n",x,orig); n=1; y=x-1; p=0.0; ty=y; itm=y; s=-1; while (n <= m) { s=-s; p=p+s*itm; ty=ty*y; itm=ty/(n+1); n++; if (itm < 0) itm=-itm; if (itm < tow) break; printf("itm=%lf tow=%lf n=%d\n",itm,tow,n); getche(); } if (n > m) printf("method fail!!!\n"); else printf("simulate n=%d ln(%lf)=%lf\n ",n,x,p); }