Average of Squares of Natural Numbers | Function to calculate average of square number ; Driver code
function AvgofSquareN ( n ) { let sum = 0 ; for ( let i = 1 ; i <= n ; i ++ ) sum += ( i * i ) ; return sum / n ; } let n = 2 ; document . write ( AvgofSquareN ( n ) . toFixed ( 6 ) ) ;