Почему не проходит 3 пункт?
package com.javarush.task.task04.task0442;
import java.io.*;
import java.util.*;
/*
Суммирование
*/
public class Solution {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int b = 0;
while (true){
int a = in.nextInt();
if (a == -1)
break;
else
b = a+b;
}
System.out.print(b);
}//напишите тут ваш код
}