Addition of Series of Numbers Increasing by 10 – CSKC
Sign In

Search

Solved Problem #CPP#5350    siteicon   siteicon  

Problem Statement - Addition of Series of Numbers Increasing by 10

Write a program to find the sum of following series with any looping statement
12 + 22 + 32 ……… +72

Solution

TC++ #5350

 

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Alternate (?) :

int n=12,sum=0;
First term of series has been fixed at value 12.  Sum has been initialised to 0;

for(int i=0; i<7; ++i) {
Since 7 terms have to be summed so a loop from 0 to <7 has been run.

sum+=n;
This will increase the sum by series term in order 12, 12+22, 22+32 … etc.

n+=10; }
This will compute the next series term by adding 10 as given.

cout<<“Sum of series 12+22+32.+..72 would be “<<sum<<” “;
This will finally print the sum.


Share

Created: 9-Dec-2018 19:04 | Updated: 9-Dec-2018 19:18|