Mean of fourth powers of first N natural numbers | Java program for the above approach ; 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
class GFG { static double findAverage ( int N ) { double S = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { S += i * i * i * i ; } return S / N ; } public static void main ( String [ ] args ) { int N = 3 ; System . out . println ( findAverage ( N ) ) ; } }