Count number of triplets with product equal to given number |  ; Consider all triplets and count if their product is equal to m ; Driver method
/ *function countTriplets(arr,n,m) { let count = 0 ; for ( let i = 0 ; i < n - 2 ; i ++ ) for ( let j = i + 1 ; j < n - 1 ; j ++ ) for ( let k = j + 1 ; k < n ; k ++ ) if ( arr [ i ] * arr [ j ] * arr [ k ] == m ) count ++ ; return count ; } let arr = [ 1 , 4 , 6 , 2 , 3 , 8 ] ; let m = 24 ; document . write ( countTriplets ( arr , arr . length , m ) ) ;