Answer to Question #206478 in C++ for burhan

Question #206478

Write a program to display the summation of the following series :


12 + 32 + 52 + 72 + 92 + 112 + 132

+ 152


1
Expert's answer
2021-06-13T10:24:40-0400

#include <iostream>

#include<vector>

using namespace std;


int main()

{

  vector<int>series = {12,32,52,72,92,112,132,152};

  int sum = 0;

  for(int i = 0; i < int(series.size()); i++){

    sum += series[i];

  }

  cout<<"Sum of the given series is : "<<sum<<"\n";

  return 0;

}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog