#include<stdio.h>
double power(double x,double y);
int main()
{
double x,y,result;
scanf("%lf %lf",&x,&y);
result=power(x,y);
printf("%lf to the %lf is %lf",x,y,result);
}
double power(double x,double y)
{
double temp;
if(y>0){
;
return (x*power(x,--y));
}
if(y==0){
if(x==0){
printf("0 to the 0 is underfined\n");
}
return 1;
}
if(y<0){
temp=1/x;
return (temp*power(x,++y));
}
}
c primer plus 第九章第九题
最新推荐文章于 2024-10-02 06:00:47 发布