Iterative approach

Iterative means to do some steps repeatedly until a condition fails

for(i=1;in;i++) { ans=ans*x; } // T.C= O(N) // S.C= O(1)

Transclude of Power-function#^7b39ce