Write a program that reads an integer n> 0 and prints n terms of the series 4,12,24,40,60 ... It should also print the sum of n
Write a program that reads an integer n> 0 and prints n terms of the series 4,12,24,40,60 ... It should also print the sum of n
The problem is more mathematical than programming, the first thing is to guess what law the series follows. There is no unique way to achieve such a thing.
What I would do is first to see that all are multiples of four, and after dividing I have 1,3,6,10,15; these terms are separated by 2 3 4 5 ... With this you could already discover the law and therefore generate the sequence.