Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone help me with this program solution? Calculate and display n terms of

ID: 3621054 • Letter: C

Question

Can someone help me with this program solution?

Calculate and display n terms of a geometric series whose common ratio is 'r', starting at an arbitrary number 'arb'. Also, calculate and display the sum of the 'nterms'. The user will enter 'nterms', 'r', and 'arb'. For example if the arbitrary starting number was 3, and the common ratio was 2 and the user wished to see 4 terms, then the series would be: 3, 6, 12, 24 and the sum of the 4 terms would be 45.

Write the program that will interactively get nterms, ratio, and arbitrary, calculate
each of the series’ terms, calculate the sum of the terms, and display each term and
the sum of the terms.

Explanation / Answer

please rate - thanks

#include <iostream>
using namespace std;
int main()
{int sum=0,i,nterms,r,arb;
cout<<"Enter the number of terms: ";
cin>>nterms;
cout<<"Enter the common ratio: ";
cin>>r;
cout<<"Enter the arbitrary starting number: ";
cin>>arb;
cout<<"The terms are: ";
cout<<arb<<" ";
sum=arb;
for(i=1;i<nterms;i++)
{arb*=r;
sum+=arb;
cout<<arb<<" ";
}
cout<<" The sum of the terms is "<<sum<<endl;
system("pause");
return 0;
}