Average of Squares of Natural Numbers | C ++ program to get the Average of Square of first n natural numbers ; Function to get the average ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float AvgofSquareN ( int n ) { return ( float ) ( ( n + 1 ) * ( 2 * n + 1 ) ) / 6 ; } int main ( ) { int n = 10 ; cout << AvgofSquareN ( n ) ; return 0 ; }