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; }
Comments
You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!
thank you very much it works 100%.you are great!!!
Leave a comment