60 564
Assignments Done
97,9%
Successfully Done
In April 2018

Answer to Question #24024 in C++ for Megha

Question #24024
c++ programming for the series

1 + (1+2) + (1+2+3) + (1+2+3+4) .......................................
Expert's answer
#include <iostream>

int main(){

int N = 3, sum = 0, bias = 0;

for (int i = 1; i<=N; i++ ){
bias +=i;
sum += bias;
std::cout<<"i = "<<i<<"bias = "<<bias<<"\n";
}

std::cout<<"1 + (1+2) + ... + (1+2+...+"<<N<<") = "<<sum<<"\n";
getchar();

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions