Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/codemistic/Data-Structures-and-Algorithms
/ IterativePower
Function
IterativePower
CPP/Maths/powerIterative.cpp:14–24 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
12
using namespace std;
13
14
int IterativePower(int x,int n){
15
int res = 1;
16
while( n ){
17
if(n & 1){
18
res = res * x ;
19
}
20
x = x * x ;
21
n = n>>1;
22
}
23
return res;
24
}
25
26
int main(){
27
int x,n;
Callers
1
main
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected