变成出现sinx=-1.#IND00的结果 是哪个地方出错了呢
#include<stdio.h>#include<math.h>
int main()
{int n;
double x,p,sign,pi,sin;
printf("please input x=");
scanf("%f",&x);
pi=3.1415926;
x=x*pi/180;
sin=0;
p=x;
n=2;
sign=1;
while(n<=20)
{
sin=sin+p;
sign=(-1)*sign;
p=sign*p*x*x/(2*n-1)/(2*n-2);
n=n+1;
if(fabs(p)<1e-9)break;
}
printf("sinx=%f\n",sin);
return(0);
}