Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
3
using namespace std;
4
5
int 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
16
int main(){
17
int a,b;
Callers
2
power
Method · 0.50
myPow
Method · 0.50
Calls
no outgoing calls
Tested by
no test coverage detected