Summe aller Zahlen in Array Java
int[] a = {10,20,30,40,50};
int sum = IntStream.of(a).sum();
System.out.println("The sum is " + sum);
Angry Antelope
int[] a = {10,20,30,40,50};
int sum = IntStream.of(a).sum();
System.out.println("The sum is " + sum);
var numbers = [10, 20, 30, 40]
var sum = 0;
for (var i = 0; i < numbers.length; i++) { sum += numbers[i]}
int [] arr = {1,2,3,4};
int sum = Arrays.stream(arr).sum(); //prints 10
const numbers = [10, 20, 30, 40]
add = (a, b) => a + b
const sum = numbers.reduce(add)