求函数
函数头为double power(double x,int n)。在主函数中输入x、n并调用该函数求
#include<stdio.h>
#include<math.h>
double power(double x,int n)
{
int m;
m=pow(x,n);
return m;
}
int main()
{
double x,y;
int n;
scanf("%d%lf",&n,&x);
y=power(x,n);
printf("%.2f",y);
return 0;
}
运行结果: eg:5的3次方。