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?

22nd Nov 2019, 2:04 AM
Daniel
Daniel - avatar
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.......
22nd Nov 2019, 2:27 AM
Avinesh
Avinesh - avatar
+ 1
Try searching for recursion.
22nd Nov 2019, 2:14 AM
Aayush Bhansali
Aayush Bhansali - avatar