Print the first N terms of the series 6 , 28 , 66 , 120 , 190 , 276 , ... | Function to print the series ; Initialise the value of k with 2 ; Iterate from 1 to n ; Print each number ; Increment the value of K by 2 for next number ; Given number N ; Function Call
function printSeries ( n ) { let k = 2 ; for ( let i = 0 ; i < n ; i ++ ) { document . write ( ( k * ( 2 * k - 1 ) ) + " " ) ; k += 2 ; } document . writeln ( " " ) ; } let N = 12 ; printSeries ( N ) ;