Sum Them All
Calcule the sum of an array off integers. For example, if numbers = [3, 13, 4, 11, 9], the sum is 40.
Function Description
Complete the function arraySum in the editor below. The function must return the integer sum of the numbers array.
arraySum has the following parameter(s):
number[numbers[0]], ...numbers[n-1]]: an array of integers
Constraints
. 1 <= n <= 10^4
. 1 <= numbers[i] < = 10^4
Input from stdin will be processed as follows and passed to the function.
The first line contains an integer n, the size of the array numbers.
Each of the next n lines contains an integer numbers[i] where 0 <= i<= n.
Ohhh okay just a thought. I think if you created a global variable, looped through the object/array using for...in
and then take the global variable and add it to the next value of the array it will most likely work :D
isnt there a built in function for this...
What have you tried so far?
Please stop posting your homework here. Try to post stuff your proud of rather than everything you do :)
@theangryepicbanana lmao
@AdCharity oh I misunderstood lol. looked like it was in the share section
@theangryepicbanana actually I didn't notice I just said lmao cause I always do that
lmao