#include <stdio.h>
#include <stdlib.h>
int main(){
int i, k, x, n;
scanf("%d %d",&x,&n);
k=1;
for(i=1;i<=n;i++){
k*=x;
}
printf("%d^%d = %d\n",x,n,k);
return(0);
} |
|
#include <stdio.h>
#include <stdlib.h>
int f(int x , int n){
if(n<1)
return(1);
else
return(f(x , n-1)*x);
}
int main(){
int k, n, x;
scanf("%d %d",&x, &n);
k=f(x, n);
printf("%d^%d = %d\n",x,n,k);
return(0);
} |