Mean of fourth powers of first N natural numbers | Function to find the average of the fourth power of first N natural numbers ; Stores the sum of the fourth powers of first N natural numbers ; Calculate the sum of fourth power ; Return the average ; Driver Code
function findAverage ( N ) { var S = 0 ; var i ; for ( i = 1 ; i <= N ; i ++ ) { S += i * i * i * i ; } return S / N ; } var N = 3 ; document . write ( findAverage ( N ) ) ;