> 数学 >
编写程序用虾类公式计算cosx的近似值,精度要求:通项的绝对值小于等于10-6是止
COSx=1-x*x/2!+x*x*x*x/4!-x*x*x*x*x*x/6!+...+(-1) n x*x n/(2n)
人气:478 ℃ 时间:2020-04-05 16:03:25
解答
#include"stdio.h"#include"math.h"main(){int t=-1,i=2,j;double h,a=1,b,x,s=1,m;printf("int put X:");scanf("%lf",&x);m=x*x;h=x;while(fabs(h)>=1e-6){a=a*m;for(b=1,j=1;j
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版