Find N Geometric Means between A and B | Pr$s N geometric means between A and B . ; calculate common ratio ( R ) ; for finding N the Geometric mean between A and B ; Driver Code
< ? php function printGMeans ( $ A , $ B , $ N ) { $ R = pow ( ( $ B / $ A ) , 1.0 / ( $ N + 1 ) ) ; for ( $ i = 1 ; $ i <= $ N ; $ i ++ ) echo $ A * pow ( $ R , $ i ) , " ▁ " ; } $ A = 3 ; $ B = 81 ; $ N = 2 ; printGMeans ( $ A , $ B , $ N ) ; ? >