#include
#include
#define myfabs(x) (x > 0 ? x : -x)
double mysin(double x)
{
int n;
double term, sum;
n = 1;
term = sum = x;
do {
n += 2;
term *= (-x * x) / ((float)(n)-1) / (float)(n);
sum += term;
} while (myfabs(term) >= 1e-6);
return sum;
}
int main()
{
double x;
printf("Enter a radian number x : ");
scanf("%lf", &x);
printf("mysin(%lf) = %.10lf, sin(%lf) = %.10lf\n", x, mysin(x), x, sin(x));
return 0;
}