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 ; Store the resultant average calculated using formula ; Return the average ; Driver Code
import java . util . * ; class GFG { static double findAverage ( int N ) { double avg = ( ( 6 * N * N * N * N ) + ( 15 * N * N * N ) + ( 10 * N * N ) - 1 ) / 30.0 ; return avg ; } public static void main ( String args [ ] ) { int N = 3 ; System . out . print ( findAverage ( N ) ) ; } }