Average of Squares of Natural Numbers | Function to get the average ; Driver Code
< ? php function AvgofSquareN ( $ n ) { return ( ( $ n + 1 ) * ( 2 * $ n + 1 ) ) / 6 ; } $ n = 2 ; echo ( AvgofSquareN ( $ n ) ) ; ? >