Mean of fourth powers of first N natural numbers | C ++ 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; double findAverage ( int N ) { double avg = ( ( 6 * N * N * N * N ) + ( 15 * N * N * N ) + ( 10 * N * N ) - 1 ) / 30.0 ; return avg ; } int main ( ) { int N = 3 ; cout << findAverage ( N ) ; return 0 ; }