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

 

gaurav.gupta@mq.edu.au arrays > sumNegatives
prev  |  next  |  chance

Define a function that when passed an array, returns the sum of all negative numbers in the array.


sumNegatives([10, 70, 20, 90]) → 0
sumNegatives([-10, 70, 20, -90]) → -100
sumNegatives([-1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) → -55

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

int sumNegatives(int[] a) { }

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: 1 Post-solution available

Copyright Nick Parlante 2017 - privacy