解题思路:
注意事项:
参考代码:
#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 人评分
C二级辅导-同因查找 (C语言代码)浏览:589 |
简单的a+b (C++语言代码)浏览:889 |
【偶数求和】 (C语言代码)浏览:670 |
淘淘的名单 (C语言代码)浏览:1162 |
C语言程序设计教程(第三版)课后习题11.8 (C语言代码)浏览:906 |
C语言程序设计教程(第三版)课后习题8.2 (C语言代码)浏览:5262 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:587 |
勾股数 (C语言代码)浏览:823 |
单词个数统计 (C语言代码)浏览:1043 |
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:499 |