пишет: " -1 должно учитываться" , хотя при входных числах 14; 11; 19; 9; -1 выводит ответ 52(верный)
package com.javarush.task.task04.task0442;
/*
Суммирование
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String a = reader.readLine();
String b = reader.readLine();
String c = reader.readLine();
String d = reader.readLine();
String e = reader.readLine();
int aa = Integer.parseInt(a);
int bb = Integer.parseInt(b);
int cc = Integer.parseInt(c);
int dd = Integer.parseInt(d);
int ee = Integer.parseInt(e);
while (true) {
if (aa!=-1&&bb!=-1&&cc!=-1&&dd!=-1&&ee!=-1){System.out.println(aa+bb+cc+dd+ee);
break;
}
else if (aa==-1) {
System.out.println(aa);
break;
}
else if (bb==-1) {
System.out.println(aa+bb);
break;
}
else if (cc==-1) {
System.out.println(aa+bb+cc);
break;
}
else if (dd==-1) {
System.out.println(aa+bb+cc+dd);
break;
}
else if (ee==-1) {
System.out.println(aa+bb+cc+dd+ee);
break;
}
}
//напишите тут ваш код
}
}