C中正弦波近似值的递归计算

递归函数 Approx_sin(x,n)=x - x^3/3!+ x^5/5!- x^7/7!+ ...(-1)^n * x^(2*n-1) / (2*n-1)!谁计算 阶数 n.
n阶正弦近似值的递归计算”

#include
#include

unsigned long fact_recursive (unsigned short nombre)
{
if (number == 0)
return 1;
else
返回数字 * fact_recursive(数字 - 1);
}

unsigned int puiss(long int x, int n)
{
if(n == 0)
return 1;
if(n == 1)
return x;
int x2 = power(x,n/2);
if(n%2 == 0)
返回 x2 * x2;
return x2 * x2 * x;
}

float Approx_sin(float x, int n)
{
float fraction = (float)puiss(x,2*n-1) / (float)fact_recursive(2*n-1);
//显示
if(n%2==1)
printf(n = %d -->%f\n,n,分数);
else
printf(n = %d -->-%f\n,n,分数);

//终端条件 if n=1 then Approx_sin=x;
if(n==1)
{
return x;
}
else{
//如果 n 为奇数,则符号为正
if(n%2==1)
return calcul_formule(x,n-1)+馏分;
//如果n为奇数,则符号为负数
否则
返回calcul_formule(x,n-1)-fraction;
}
}

int main(int argc, char *argv[])
{
int n;
float x;
printf(输入 x 的值:”);
scanf(%d”,&x);
printf(输入 n 的值:”);
scanf(%d”,&n);
//公式计算
printf(Approx_sin(%f, %d ) = %f\n”,x,Approx_sin(x,n) );
system(暂停”);
}