C语言求SIN(X)求纠错#includeint main(){double x,term;double sin=0;int sign=1,n=1;scanf("%lf",&x);term=(double)(sign*x)/n;for(;term>=1e-5;n=n+2){sin+=term;term=sign*term*x*x/((n+1)(n+2));sign=-sign;}printf("%lf",sin);return 0;}---------------

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 05:12:27
C语言求SIN(X)求纠错#includeintmain(){doublex,term;doublesin=0;intsign=1,n=1;scanf("%lf",&x);term=(double)(

C语言求SIN(X)求纠错#includeint main(){double x,term;double sin=0;int sign=1,n=1;scanf("%lf",&x);term=(double)(sign*x)/n;for(;term>=1e-5;n=n+2){sin+=term;term=sign*term*x*x/((n+1)(n+2));sign=-sign;}printf("%lf",sin);return 0;}---------------
C语言求SIN(X)求纠错
#include
int main()
{
double x,term;
double sin=0;
int sign=1,n=1;
scanf("%lf",&x);
term=(double)(sign*x)/n;
for(;term>=1e-5;n=n+2)
{
sin+=term;
term=sign*term*x*x/((n+1)(n+2));
sign=-sign;
}
printf("%lf",sin);
return 0;
}
-------------------Configuration:1 - Win32 Debug--------------------
Compiling...
1.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(14) :error C2064:term does not evaluate to a function
Error executing cl.exe.
1.obj - 1 error(s),0 warning(s)

C语言求SIN(X)求纠错#includeint main(){double x,term;double sin=0;int sign=1,n=1;scanf("%lf",&x);term=(double)(sign*x)/n;for(;term>=1e-5;n=n+2){sin+=term;term=sign*term*x*x/((n+1)(n+2));sign=-sign;}printf("%lf",sin);return 0;}---------------
在数学里乘号可以省略不写,类似(n+1)(n+2)这样.
但是程序里不能省略,所以
term=sign*term*x*x/((n+1)(n+2));
应该是:
term=sign*term*x*x/((n+1)*(n+2));

C语言求SIN(X)求纠错#includeint main(){double x,term;double sin=0;int sign=1,n=1;scanf(%lf,&x);term=(double)(sign*x)/n;for(;term>=1e-5;n=n+2){sin+=term;term=sign*term*x*x/((n+1)(n+2));sign=-sign;}printf(%lf,sin);return 0;}--------------- 求纠错, c语言编程 求sin(x)的近似值 描述:利用公式求sin(x)的近似值(精度为10e-6).sin(x)=x-x^3/3!+x^5/5!- 求纠错和指导 第二问求纠错, 已写,求纠错 已写,求纠错 已做,求纠错 C语言利用泰勒公式,计算sin(x)!麻烦你教我一下,跪求,谢谢大神 C语言求三角函数f(x,y,z)=sin(x)/(sin(x-y)*sin(x-z))+sin(y)/(sin(y-x)*sin(y-z))+sin(z)/(sin(z-x)*sin(z-y))代码#include #include double fun(double x,double y,double z){double a,b,c,sum;a=sin(x)/(sin(x-y)*sin(x-z));b=sin(y)/(sin(y-x)*sin(y-z));c c语言 求任意两整数之间所有的完数 (求大神纠错)#include stdio.hint main(){ int a,b,n,s=0,i; scanf(%d%d,&a,&b); for(n=a;n C语言编程求正弦 sin(x) 的近似值如题 已知求正弦 sin(x) 的近似值的多项式公式为:sin(x) = x - x 3 /3!+ x 5 /5!- x 7 /7!+ …… + (-1) n x 2n+1 /(2n+1)!+ … 编写程序,要求输入 x (单位是弧度)和ε,按上述 C语言的注释语句是不是这样写的,//includ //(while 循环) #inc c语言 sin(x)+cos(x)编程 C语言编程求正弦,、已知求正弦 sin(x) 的近似值的多项式公式为:sin(x) = x - x3/3!+ x5/5!- x7/7!+ …… + (-1)n x2n+1/(2n+1)!+ …编写程序,要求输入 x (单位是弧度)和ε,按上述公式计算 sin(x) 的近似值, C语言求解释 C语言求解释 求一道 c语言 :)