解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<math.h>
double fact(double n)
{double a=1;
for(int i=1;i<=n;i++)
a=a*i;
return(a);
}
double mypow(double x,double n)
{double s=0;
for(int i=1;i<=n;i++)
s=s+pow(-1,i+1)*pow(x,i)/fact(i);
return(s);}
main()
{double x,n;
scanf("%lf %lf",&x,&n);
printf("%.4lf",mypow(x,n));}
0.0分
0 人评分
Tom数 (C++代码)浏览:861 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:544 |
兰顿蚂蚁 (C++代码)浏览:1145 |
求组合数 (C语言代码)浏览:1195 |
简单的a+b (C语言代码)浏览:554 |
a+b浏览:447 |
简单的a+b (C语言代码)浏览:613 |
敲七 (C++代码)浏览:1106 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:810 |
上车人数 (C语言代码)浏览:750 |