Answer to Question #206472 in C++ for She

Question #206472

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:32-0400
#include <iostream>


using namespace std;


int main()
{
    int sum=0;
    for(int i=12;i<=152;i+=20){
       sum+=i;
        if (i==152)
            cout<<i<<" = ";
        else
            cout<<i<<" + ";
        
    }
    cout<<sum;
    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