C语言问题 利用 sinx约=x - x^3/3! + x^5/5! - x^7/7! +...;计算sinx 直到最后一项的绝对值小于10^-5为止
请问我空着的地方应该填什么#include<stdio.h>#include<math.h>main(){intn=1,count=1;floatx;doublesum,...
请问我空着的地方应该填什么
#include<stdio.h>
#include<math.h>
main()
{
int n = 1,count = 1;
float x;
double sum,term;printf("Input x:");
scanf("%f", );
sum = x;
term = x;
do{
term = ;
sum = sum + term;
n = n + 2;
;
}while( );
printf("sin(x) = %f,count = %d\n",sum,count);
} 展开
#include<stdio.h>
#include<math.h>
main()
{
int n = 1,count = 1;
float x;
double sum,term;printf("Input x:");
scanf("%f", );
sum = x;
term = x;
do{
term = ;
sum = sum + term;
n = n + 2;
;
}while( );
printf("sin(x) = %f,count = %d\n",sum,count);
} 展开
2个回答
2018-11-03
展开全部
&x
-term*x*x/((n+1)*(n+2))
count++
fabs(term)>=1e-5
-term*x*x/((n+1)*(n+2))
count++
fabs(term)>=1e-5
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询