5.Write an object-oriented program in C++ to find the sum of the following series:
(a) sum = 1 + 2 + 3 + ….. + n
(b) sum = 1 + 3 + 5 + ….. + n
(c) sum = 1 + 2 + 4 + ….. + n
(d) sum = 12 + 22 + 32 + 32 + 42 + … + n2
(e) sum = 13 + 23 + 33 + 43 + … + n3
(f) sum = 1 + 22 + 42 + … + n2
(g) sum = 1 + 32 + 52 + … + n2
5. Write an object-oriented program in C++ to generate the following figures:
(i) (ii)
9 98$ 987$$ 987$$$ 987$$$$ 987$$$$$ 987$$$$$$ 987$$$$$$$987 * * * * * * * ! $ !****** $!$***** !$!**** $!$****** !$!$!$!$!!$! |
$
$ $
$ $
$ $ 6
$ $ 6 5
$ $ 6 5 4
$ $ 6 5 4 3
$ $ 6 5 4 3 1
$ $ 6 5 4 3 2 1
(iii) (iv)
* * $ ! $ ! $ !
* * ! $ ! $ !
* * $ ! $ !
* * ! $ !
* * $ !
* * !
* *
* *
*