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

 

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

Write a method that returns the sum of all the positive numbers in array 'nums', UNLESS 'reverse' is 'true'. In that case return the sum of all the negative numbers in the array.


mar5_2020_APP1SLHL_sumPos([6152, 4352, -352, 346, -685], false) → 10850
mar5_2020_APP1SLHL_sumPos([6152, 4352, -352, 346, -685], true) → -1037
mar5_2020_APP1SLHL_sumPos([-521, -24, 36, 235, 754, -352], false) → 1025

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

public int mar5_2020_APP1SLHL_sumPos(int[] nums, boolean reverse) { }

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