#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
double power(double n, int p);
int to_binary(int, int);
int main(void)
{
double n;
int p;
while (scanf("%lf%d", &n, &p) == 2)
{
printf("%f 的 %d 次方等于 %lf\n",n,p,power(n, p));
}
to_binary(129, 8);//129十进制转8进制为201
return 0;
}
double power(double n, int p)//求n的p次方函数
{
double pow = 1;
int i;
if (p == 0)
;
else if (p < 0)
pow = 1 / n * power(n, p + 1);
else
pow = n * power(n, p -1);
return pow;
}
int to_binary(int a, int b)//十进制转*进制,a为十进制数,b为要转换的进制如8进制就写8.
{
if (a / b != 0)
to_binary(a / b, b);
else
{
printf("%d", a % b);
return a % b;
}
printf("%d",a%b);
return a % b;
}