Untitled
unknown
c_cpp
4 years ago
311 B
10
Indexable
int getPower(int B,int P){
if(P==0){
return 1;
}
if(P%2==0){
int halfPower = P/2;
int value = getPower(B,halfPower);
return value * value;
}
else{
return B * getPower(B,P-1) ;
}
}Editor is loading...