Write you own Power without using multiplication ( * ) and division ( / ) operators | Works only if a >= 0 and b >= 0 ; driver program to test above function
function pow ( a , b ) { if ( b == 0 ) return 1 ; var answer = a ; var increment = a ; var i , j ; for ( i = 1 ; i < b ; i ++ ) { for ( j = 1 ; j < a ; j ++ ) { answer += increment ; } increment = answer ; } return answer ; } document . write ( pow ( 5 , 3 ) ) ;