Answers for "calculate the sum of integers in an array in java"

7

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
0

how to find the sum of an array in java

int [] arr = {1,2,3,4};
int sum = Arrays.stream(arr).sum(); //prints 10
Posted by: Guest on October-09-2021

Code answers related to "calculate the sum of integers in an array in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language