Для каждого суммирования цикла
public class Sample {
public static void main(String[] args) {
int num[] = { 1, 2, 3, 4, 5 };
int sum = 0;
for (int numbers : num) {
sum = sum + numbers;
}
System.out.println("The total sum is " + sum);
}
}
Fernandez, Jasmine M.