accumulate

Accumulate the sum of a sequence.

 template <class InputIterator, class T> 
 T accumulate(InputIterator first, InputIterator last, T init);
 template <class InputIterator, class T, class BinaryOperation>
 T accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op);
  
Remarks

The sum of the values in a range or the sum of the values after being processed by an operation is returned.