Sum of sum | Java program to implement the above approach ; Function to find the sum ; Calculate sum - series for every natural number and add them ; Driver code
class GFG { static long sumOfSumSeries ( int N ) { long sum = 0L ; for ( int i = 1 ; i <= N ; i ++ ) { sum = sum + ( i * ( i + 1 ) ) / 2 ; } return sum ; } public static void main ( String [ ] args ) { int N = 5 ; System . out . println ( sumOfSumSeries ( N ) ) ; } }