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

 

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

Write a method that returns the sum of the integers in the input array, excluding any 5's that appear in the array from the sum. For example: addNums({4, -3, 5, -1, 8, -11}) returns a 1, because if you exclude 5, the other numbers add up to 1.


addNums([5, 5, 5, 5, 5]) → 0
addNums([1, 3, -2, -5, 6, 1]) → 4
addNums([4, -3, 5, -1, 8, -7]) → 1

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

public int addNums(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: 205

Copyright Nick Parlante 2017 - privacy