Answer to Question #22178 in C++ for emmanuel

Question #22178
write a program using c++ to find the sum of arithmetic progression below. 6,10,14,18,20
1
Expert's answer
2013-01-16T11:48:12-0500
#include <iostream>
int main()
{
int a[] ={6,10,14,18,20};
int n=5; //number of elements in a
int sum = 0;
for(int i=0; i<n;i++)
{
sum +=a[i];
}
std::cout<< "The sum of progression is " << 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

Assignment Expert
17.01.13, 14:10

You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!

emmanuel
17.01.13, 08:07

thank you very much it works 100%.you are great!!!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS