I just need to know what types of statements for the following:
Denition 1. An arithmetic series is the sum of a sequence fakg, k = 1; 2; : : : ;
in which each term is computed from the previous one by adding (or subtracting) a constant d, the common difference. Therefore, for k > 1,
ak = ak1 + d = ak2 + 2d = : : : = a1 + d(k 1).
For example, 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 is an arithmetic series
whose first term, a1, is 1, common difference, d is 1, and number of terms, k
is 10. This series is equals to 55.
Write a C++ program that prompts the user to enter the first term of an
arithmetic series, its common difference, and the number of terms. Your
program should then compute the series, s(a1; d; k). Name your source file
aseries.cpp. :
Sample Run 1:
What is the first term of the series? 1
What is the difference between adjacent terms? 1
How many terms does the series have? 0
Error -> The number of terms must be a positive integer.
Sample Run 2:
What is the first term of the series? 7
What is the difference between adjacent terms? 12
How many terms does the series have? 1
s(7,12,1) = 7
Sample Run 3:
What is the first term of the series? 1
What is the difference between adjacent terms? 1
How many terms does the series have? 10
s(1,1,10) = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55
Sample Run 4:
What is the first term of the series? 3
What is the difference between adjacent terms? -2
How many terms does the series have? 8
s(3,-2,8) = 3 + 1 - 1 - 3 - 5 - 7 - 9 - 11 = -32
Sample Run 5:
What is the first term of the series? -3.75
What is the difference between adjacent terms? 1.25
How many terms does the series have? 7
s(-3.75,1.25,7) = -3.75 - 2.5 - 1.25 + 0 + 1.25 + 2.5 + 3.75 = 0