Question: programming language 17 // Lab 4 / Descriptiont Write a program that will find the sum of a arithmic series given the first term, its

programming language

programming language 17 // Lab 4 / Descriptiont Write a program that

17 // Lab 4 / Descriptiont Write a program that will find the sum of a arithmic series given the first term, its difference and the number of terms in the series. // 1. Declare the needed variables // 2. Collect the user input (a - first term, d-difference, n-number of terms // 3. Find the sum (Using a loop) 17 4. Find the sum (Using the formula below) // 4. Print BOTH sums, they should match!!! 1/ Note: For example, if a = 1, d - 3, n - 4 then the series is: 1 + 4 + 7 + 10 and the sum - 22 // if a - 8, d. -5, n = 5 then the series is 8 + 3 + (-2) + (-7) + (-12) and the sum - -10 Sum - n + (2. a + (n-1).d) / 2; . . . . . . #include using namespace std; // Header file needed for I/O ine used for simplicity int main() // 1. Declare the variables needed for this program. 11 Use a, d, n and sum as integers // You may declare other variables as needed int a, d, n; int suml - 0; // Sum from the loop int sumF = 0; // Sum from the formula 1/ 2. Collect the user input needed cout > a: cout > d; cout >n; 1/ 3. Once the input is entered, use a loop to find the sun // 4. Find the sum using the formula 15. After the sum is calcualted find the su cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!