#include <stdio.h>
int power( int, unsigned int);
int main(){
int base, comp;
while(1){
scanf("%d %d", &base, &comp);
printf("%d^%d = %d\n", base, comp, power( base, comp ));
}
}
int power( int base, unsigned int comp ){
if(comp == 0) return 1;
if(comp == 1) return base;
return base * power( base, comp - 1 );
}
[C How To Program] 习题5.37 x的n次方
最新推荐文章于 2022-12-18 01:22:50 发布