#include<stdio.h>
#include<math.h>
int main()
{
double x,sinx,sum,y;
int n;
scanf("%lf",&x);
sum=x; y=x;
n=1;
while(fabs(y)>=1e-6);
{
y=(-1)*y*x*x/((2*n+1)*(2*n));
sum=sum+y;
n++;
}
printf("sinx的近似值为%f,sinx的真实值为%f",sum,sin(x));
}
有什么问题吗?为什么不能运行
C语言sin怎么用
1。弧度main(){floatx,a,b;printf("Enternumber:");scanf("%f
c语言编程中,sinx怎么表示?
在写C语言的程序时,在开头加上一个头文件math.h即可。即可直接使用sin(x),特别注意x应该为弧度制,如果不是弧度制需要转化为弧度制。添加头文件方法:#include<math.h>。
c语言编程sinx
while(fabs(y)>=1e-6)\/\/去掉分号printf("sinx的近似值为%lf,sinx的真实值为%lf",sum,sin(x));\/\/是lf
c语言问题 编写程序,计算sinx的近似值,精确到10的负六次方
sinx+=a\/b;a=-a*x*x;b=b*2*i*(2*i+1); } printf("%f",sinx);}
C语言编程计算sinx的近似值
int i;printf("Please enter x & eps(R:0<eps<1)...\\n");if(scanf("%lf%lf",&x,&eps)!=2 || eps<=0 || eps>=1){printf("Input error, exit...\\n");return 0;}printf("sin(%g)≈",x);for(s=t=x,x*=x,i=1;t>=eps;i++){(t*=x)\/=((i*i<<2)+i+i)...
C语言,用泰勒展开式表达sinx?
C语言,用泰勒展开式表达sinx?\/\/用泰勒展开式表达sinx#include<stdio.h>#include<math.h>\/\/定义一个阶乘函数doublefenmu(doublen){if(n==1)return1;elsereturnn*(n-1);}intmain(){doublex,n=1,sign=1,sinx=0,term=... \/\/用泰勒展开式表达sinx #include<stdio.h>#include<math.h>\/\/定义一个阶乘...
C语言求sinx
include<stdio.h> int main(){ int i,n;double t,x,y=0;scanf("%lf%d",&x,&n);y=t=x;x*=x;for(i=3;i<2*n;i+=2){t=-t*x\/(i*(i-1));y+=t;} printf("%.8lf\\n",y);return 0;}
c语言利用泰勒级数求sinx,并统计多少项?不知道哪里出错,求大神_百度...
include<stdio.h>#include<math.h>int main(){float jc(int n); \/\/有改动float x,sin=0,b=0; \/\/有改动int m=1,i=1,c=2;printf("请输入sinx中x的值:");scanf("%f",&x);do{b=pow(-1,c)*pow(x,m)\/jc(m);sin+=b;m+=2;c+=1;i++;}while(fabs(b)>=pow(10...
c语言 从键盘输入x的值计算sinx,ln(x+1),e^x,|cosx|的值
include "stdio.h"\/\/ include "math.h"\/\/ void main(void){ double x;scanf("%lf",&x);printf("sinx=%.2f\\n",sin(x));if(x<=-1) printf("ln(x+1) is limitless\\n");else printf("ln(x+1)=%.2f\\n",log(x+1));if((x=x+1)<0) x=-x;printf("|x+1|=%.2f\\n"...
c语言编程题应用泰勒级数计算 sin(x)的值?
double sinx(double x){ int z = -1;int i, j;double sin = x;for (i = 1; i <= N; i++){ j = 2 * i + 1;sin = sin + z * (pow(x, j) \/ fac(j));z = -z;} return sin;} int main(){ double x;scanf("%lf", &x);\/\/度数 x = (x * M_PI) \/ ...