#include <iostream>
using namespace std;
int pow(int a , int b){
int half;
if(b==0 ) // base case
return 1;
half = pow(a,b/2); //calculation
if(b%2==0){ //even and odd case
return half*half;
}
else {
return a*half*half;
}
}
int main() {
int a;
cin>>a;
int b;
cin>>b;
cout<<pow(a,b);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: