试试我这个!
#include <stdio.h>
#include <math.h>
#define EX 0.000001
#define PI 3.14159265
int main()
{
double x=0.0, temp=1.0, sin=0.0;
int i;
printf("Please input a degree:");
scanf("%lf",&x);
x=x*PI/180;
temp=x;
i=0 ;
while ( fabs(temp) >EX )
{
sin += temp;
i += 2;
temp = (-1) * temp*x*x/( (i+1)*(i) );
}
printf("sin(%lf) = %lf ",x,sin);
printf("The number is %d ",i);
return 0;
}