对运行中输入的x计算级数:1+ x – x2/2!+ x3/3!- …(-1) n+1*xn/n!.输出精度为10-8.用while和for语句各编写一个程序 ,

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 20:15:20

对运行中输入的x计算级数:1+ x – x2/2!+ x3/3!- …(-1) n+1*xn/n!.输出精度为10-8.用while和for语句各编写一个程序 ,
对运行中输入的x计算级数:1+ x – x2/2!+ x3/3!- …(-1) n+1*xn/n!.输出精度为10-8.
用while和for语句各编写一个程序 ,

对运行中输入的x计算级数:1+ x – x2/2!+ x3/3!- …(-1) n+1*xn/n!.输出精度为10-8.用while和for语句各编写一个程序 ,
#include
#include
#include

unsigned int jiecheng(unsigned x){
if(x==1){
return 1;
}else{
return x * jiecheng(x-1);
}
}

double fuc(double x ,unsigned int n){
unsigned int i;
float result = 1.0;
if(n==0){
return 1.0;
}
else{
for(i=1;i