有点小问题3??!
#include "stdio.h" #include "math.h" int n=2;
main() {double c,sn,sn1,x,k,eps=0.000001,g=0.5,j=1; printf("Please Input x="); scanf("%d",&x); k=pow(x,n); c=pow(x,n-1); sn=1.0;sn1=1.0;
do {g=g*(0.5-n+1)*k/n; sn=sn+g; j=j*(0.5-n+2)*c/(n-1); sn1=sn1+j; n=n+1; } while(fabs(sn-sn1)<eps); printf("%11.f",fabs(sn-sn1)); }
小弟的这个程序在执行后,显示Floating point error:domain 请问是哪里出问题了??