Average of Cubes of first N natural numbers | Function to find average of cubes ; Store sum of cubes of numbers in the sum ; Calculate sum of cubes ; Return average ; Given number ; Function Call
function findAverageOfCube ( n ) { let sum = 0 ; let i ; for ( i = 1 ; i <= n ; i ++ ) { sum += i * i * i ; } return sum / n ; } let n = 3 ; document . write ( findAverageOfCube ( n ) . toFixed ( 6 ) ) ;