Get the Sum of All Vector Elements

Published by AniXDownLoe in

Create a function that takes a vector and returns the sum of all numbers in the vector.

Examples

get_sum_of_elements({2, 7, 4}) ➞ 13

get_sum_of_elements({45, 3, 0}) ➞ 48

get_sum_of_elements({-2, 84, 23}) ➞ 105

Notes

Use an iterator if possible.

Watch a quick demo on how Edabit works.