#include "stdio.h"
int main(int argc,char *argv[]){
double s,x,t;
int n;
printf("Please enter x(R:)...\nx=");
scanf("%lf",&x);
for(s=t=x,n=2;n<11;n++){
(t*=(x*x))/=(n-1);
s += n&1 ? t/(n+n-1) : -t/(n+n-1);
}
printf("s(%.2f)≈%.2f\n",x,s);
return 0;
}
代码格式和运行样例: