text: Average of Cubes of first N natural numbers | C program for the above approach ; Function to find average of cubes ; Store sum of cubes of numbers in the sum ; Calculate sum of cubes ; Return average ; Driver Code ; Given number ; Function Call
code: #include <stdio.h> NEW_LINE double findAverageOfCube ( int n ) { double sum = 0 ; int i ; for ( i = 1 ; i <= n ; i ++ ) { sum += i * i * i ; } return sum / n ; } int main ( ) { int n = 3 ; printf ( " % lf " , findAverageOfCube ( n ) ) ; return 0 ; }