0
Sequence
I dont have any idea how to display the code = 1 + (1+2) + (1+2+3).... Please what is the idea behind it?
2 odpowiedzi
+ 3
Daniel Kindly try it yourself first, a simple for loop would do the job.
Edit: The logic is that the sequence starts with 1 and the the next number in the sequence is the sum of previous number and the number succeeding it.
For eg- 1, 1+2, 1+2+3,......
This is 1, 3, 6.......
+ 1
Try searching for recursion.