# Any code to add elements of a list to make a new list? [closed]

Is there any code built in to add the numbers in a list sequentially? For example, lets say I have a list B. B has 6 numbers like below.

B={0,6,5,4,3,2}


I want to produce a new list C. C will add the first two numbers in the list, so 0+6 = 6. That will be put into the new list C. Then the next term in the list C will be 0+6+5 = 11. And then 0+6+5+4 = 15, and so on. The result of the new list C will be as below.

C={6,11,15,18,20}


Any help is appreciated. Thanks.

-

## closed as off-topic by rasher, Öskå, Sjoerd C. de Vries, m_goldberg, Michael E2Jun 16 at 21:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – rasher, Öskå, Sjoerd C. de Vries, m_goldberg, Michael E2
If this question can be reworded to fit the rules in the help center, please edit the question.

Why did you tag this with webmathematica? There's no mention of webMathematica in the question. –  Szabolcs Jun 16 at 19:40
Keep in mind that C is a built-in symbol. –  Kuba Jun 16 at 19:43

Accumulate[{0, 6, 5, 4, 3, 2}]

(* {0, 6, 11, 15, 18, 20} *)

-
To get the requested result you need to add Rest: Accumulate[{0, 6, 5, 4, 3, 2}]//Rest or alternatively Accumulate[{0, 6, 5, 4, 3, 2} // Rest] –  Bob Hanlon Jun 16 at 19:54