Find N Geometric Means between A and B | insert function for calculating the means ; Finding the value of R Common ration ; for finding N the Geometric mean between A and B ; Driver Code
function printGMeans ( A , B , N ) { let R = Math . pow ( ( B / A ) , 1.0 / ( N + 1 ) ) ; for ( let i = 1 ; i <= N ; i ++ ) document . write ( A * Math . pow ( R , i ) + " " ) ; } let A = 3 , B = 81 , N = 2 ; printGMeans ( A , B , N ) ;