Skip to content

Commit

Permalink
Task. Add even. An implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
5arnA committed Feb 4, 2024
1 parent 3ee01b7 commit 79c03b1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion homework/add-even/addEven.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,14 @@
int addEven(const std::vector<int>& numbers) {
// TODO: Your implementation goes here
// Below return is only to make this function compile now
return -1;

int even_numers_sum{0};

for (auto& it : numbers) {
if (it %2 == 0) {
even_numers_sum += it;
}
}

return even_numers_sum;
}

0 comments on commit 79c03b1

Please sign in to comment.