MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / power

Function power

CPP/Maths/power.cpp:5–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace std;
4
5int power(int m,int n){
6 if(n==0){
7 return 1;
8
9 }
10 if(n%2==0){
11 return power(m*m,n/2);
12 }
13 return m*power(m*m,(n-1)/2);
14}
15
16int main(){
17int a,b;

Callers 2

powerMethod · 0.50
myPowMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected