Упражнение состоит в том, чтобы добавить сумму всех пользовательских данных.
Кажется, я не могу понять, как записать сумму = все значения «read».
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int sum = 0;
System.out.println("Enter numbers:");
while (true) {
int read = Integer.parseInt(input.nextLine());
if (read == 0) {
break;
}
read =
System.out.println("Sum now: " + sum);
}
System.out.println("Sum in the end: " + sum);
}
Вся помощь приветствуется.