Find the sum of n terms of the series 1 , 8 , 27 , 64 ... . | C # program to find the sum of n terms ; Function ot calculate the sum ; Return total sum ; Driver code
using System ; class GFG { static int calculateSum ( int n ) { return ( int ) Math . Pow ( n * ( n + 1 ) / 2 , 2 ) ; } public static void Main ( ) { int n = 4 ; Console . WriteLine ( calculateSum ( n ) ) ; } }