Sum of an array

using for loop, while loop, recursion and inject