帮贴代码:
#include<stdio.h>
main()
{
int i=0,j;
double x,m,n,sinx=0,z;
printf("请输入x:\n");
scanf("%lf",&x);
while(z>=(1/(10*10*10*10*10)))
{
i++;
for(j=i,m=1;j>=1;j--)
m=m*x;
for(j=i,n=1;j>=1;j--)
n=n*j;
z=m/n;
if(i%2==1)
sinx=sinx+z;
else
sinx=sinx-z;
printf("%d %d %lf %lf %lf %lf %lf\n",i,j,x,m,n,z,sinx);
}
printf("最后一项是第%d项,这时sinx的值是%lf",i,sinx);
}