Write you own Power without using multiplication ( * ) and division ( / ) operators | A recursive function to get x * y ; A recursive function to get a ^ b Works only if a >= 0 and b >= 0 ; Driver code
function multiply ( x , y ) { if ( y > 0 ) return ( x + multiply ( x , y - 1 ) ) ; else return 0 ; } function pow ( a , b ) { if ( b > 0 ) return multiply ( a , pow ( a , b - 1 ) ) ; else return 1 ; } document . write ( pow ( 5 , 3 ) ) ;