Sum of series 1 ^ 2 + 3 ^ 2 + 5 ^ 2 + . . . + ( 2 * n | Program to find sum of series 1 ^ 2 + 3 ^ 2 + 5 ^ 2 + . . . + ( 2 * n - 1 ) ^ 2. ; Function that find sum of series . ; Formula to find sum of series . ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int sumOfSeries ( int n ) { return ( n * ( 2 * n - 1 ) * ( 2 * n + 1 ) ) / 3 ; } int main ( ) { int n = 10 ; cout << sumOfSeries ( n ) ; return 0 ; }