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

 

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

Write a method that returns the sum of all the numbers in the array 'nums', but excluding any occurrence of 'exclude'. For example, if 'nums' is {3,1,3,3,5,3,3,3} and 'exclude' is 3, you will return 6 because that is the sum of all the non-excluded numbers. Look at the test data for examples.


quiz2023_09_15_SLHL_findSum([7, 124, 24, 4, 436, 352, 124, 436, 76, 3], 436) → 714
quiz2023_09_15_SLHL_findSum([5, 7, 2, 3, 10, 20, 7, 9, 1, 10, 7, 7, 7], 7) → 60
quiz2023_09_15_SLHL_findSum([], 122) → 0

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

public int quiz2023_09_15_SLHL_findSum(int[] nums, int exclude) { }

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: 230

Copyright Nick Parlante 2017 - privacy