Sum of negative numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Sum of negative numbers

Find the sum of the negative elements of an array. {5, 2, -13, 11, 7, 3, 0, -9};

6th May 2021, 4:39 AM
Best of Sport
Best of Sport - avatar
4 Answers
+ 3
Hints : Loop through the array Find value<0 Add them in a variable.
6th May 2021, 4:42 AM
TOLUENE
TOLUENE - avatar
+ 2
Java 8 makes this job easier than ever. https://code.sololearn.com/cUfcGlNpO6zM/?ref=app
6th May 2021, 7:23 AM
Soumik
Soumik - avatar
+ 1
Hey Best of Sport , Md Sayed given hint , now can you solve it ? If you are not able to solve then review your java lessons !
6th May 2021, 5:17 AM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
0
You should have to attempt first.. https://code.sololearn.com/cSnfFOtGhvHm/?ref=app
6th May 2021, 5:35 AM
born2code
born2code - avatar