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

 

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

Write a method that returns the sum of all the positive numbers in an array of integers. Do NOT include the negative numbers in the sum. You may not use any functional programming.


apr_9_2019_APSLHL_sumPositive([1, 1, 1, 1, 1, 1, 1, 1, 1]) → 9
apr_9_2019_APSLHL_sumPositive([-421, -4356, 123, 235, 768, -457]) → 1126
apr_9_2019_APSLHL_sumPositive([253, 235, 547, -23, -523, -152, 532, -64]) → 1567

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

public int apr_9_2019_APSLHL_sumPositive(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