由于该楼层涉嫌违规,系统将其折叠并隐藏,以显示该楼层
#包含
#包含
#define PI 3.1415927
双精度(双精度;
双精度(intn );
int main () )
{
int n,I,k,flag;
double x,sin,temp,index;
wile(Scanf('%lf%d ),x,n )!=EOF )
{
fact(x;
flag=1; 索引=0.1; temp=x; sin=0; /*初始化数据*
for(I=1; I
索引*=索引; /*10的-n次方*/
i=1;
wile(Fabs(temp )=index )/*判断循环条件) /
{
temp=flag*x/fact(I; /*先计算x/i! */
for(k=0; K
temp*=x;
sin=temp; sin*/
flag=-flag; /*符号转换*
i=2;
}
printf('%.*f(n ),n,sin ); //输出/
}
返回0;
}
doublefact(intn )/*是阶乘函数/
{
双结果;
if(n==1||n==0) ) () ) ) ) ) ) ) ) if(n==1||n==0) ) ) ) ) ) ) n ) ) n ) ) n ) ) n ) n ) n ) n ) n ) n ) n )
结果=1;
else
result=n*fact(n-1;
返回结果;
}
双精度(双精度)
{
wile(XPI/2||x
x-=2*PI;
返回x;
}