Answers for "sum of numbers in a list java"

2

sum of all numbers in array java

int[] a = {10,20,30,40,50};
int sum = IntStream.of(a).sum();
System.out.println("The sum is " + sum);
Posted by: Guest on December-11-2020
1

sum of list java

double sum = 0;
for(int i = 0; i < m.size(); i++)
    sum += m.get(i);
return sum;
Posted by: Guest on February-03-2021

Code answers related to "sum of numbers in a list java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language