#include #include oid main( double stx int n=l printf(“请输入一个弧度值:”) scanf("%lf", &x n=n+2: =t*(-x*x)/(n*(n-1) B while( fabs(t)>=le-7) /*循环结束条件是t的绝对值小于1e-7*/ printf("sin(%lf)=%lfn", x, s)
#include #include void main() { double s,t,x; int n=1; printf(“请输入一个弧度值:”) scanf("%lf",&x); t=x; s=x; do { n=n+2; t=t*(-x*x)/(n*(n-1)); s=s+t; }while(fabs(t)>=1e-7); /*循环结束条件是 t 的绝对值小于 1e-7*/ printf("sin(%lf)=%lf\n",x,s); }