Computer Science, asked by lolo98, 1 year ago

I need a c++ program to print the sum of series, 2 +(2+4) +(2+4+6) +........+ nth term.
N to be obtained from the user. 

Answers

Answered by kvnmurty
0
#include <iostream>
main ()  {
int N, i, term , j , sum ;
      cin >> N;
     for ( i=0, sum=0; i < N ; i++ ) {
           for (j=0, term=0; j < i; j++ )
               term += 2;
           sum += term;
      }
     cout <<  sum ;
}
Similar questions