Write an algorithm to find out sum of the series 1+2+3+4………N terms .
Answers
Answered by
2
#include <iostream>
using namespace std;
int calcSeriesSum(int n){
int sumVar = 0;
for(int i = 1; i <= n; i++)
sumVar = sumVar + ( (i)*(i+1)*(i+2) );
return sumVar;
}
int main(){
int n = 7;
cout<<"The sum of series till "<<n<<" is "<<calcSeriesSum(n);
return 0;
}
Similar questions