fork download
  1. #include <iostream>
  2. #include <numeric>
  3. #include <algorithm>
  4.  
  5. int main ( ) {
  6. int arr [] = {1,2,3,4,0,5,6,7,8} ;
  7. const int size = sizeof(arr)/sizeof(*arr) ;
  8. std :: cout << std :: accumulate ( std :: find ( arr , arr + size , 0 ) , arr + size , 0 ) << std :: endl ;
  9. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
26