header function of accumulate in c++ code example
Example 1: accumulate() in c++
accumulate(first, last, sum);
first, last : first and last elements of range
whose elements are to be added
suppose array is 'a'.
sum : initial value of the sum
Eg: int sum=0;
accumulate(a.begin(),a.end(),sum);
Example 2: accumulate in cpp
accumulate(start, end, initial_sum);