id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > test2020_10_29_P1SLHL_evenSumSoFar
prev  |  next  |  chance

Write a method that accepts an array called 'nums'. Return a new array that is the running sum of only the even numbers in 'nums' up to that index in the array. For example, if 'nums' is {3,6,2} you would return {0,6,8}. Only add up the even numbers in 'nums' up to that point in the array.


test2020_10_29_P1SLHL_evenSumSoFar([352, 7557, 23, 5463, 534, 5464, 243, 865, 921, 24, 523, 346, 42, 64, 34, 643, 8732, 649]) → [352, 352, 352, 352, 886, 6350, 6350, 6350, 6350, 6374, 6374, 6720, 6762, 6826, 6860, 6860, 15592, 15592]
test2020_10_29_P1SLHL_evenSumSoFar([4, 1, 2, 8, 12]) → [4, 4, 6, 14, 26]
test2020_10_29_P1SLHL_evenSumSoFar([5, 6, 22, 9, 3, 5, 17, 323, 400, 404, 753, 858]) → [0, 6, 28, 28, 28, 28, 28, 28, 428, 832, 832, 1690]

...Save, Compile, Run (ctrl-enter)

public int[] test2020_10_29_P1SLHL_evenSumSoFar(int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy