One testcase failed

This is the link for my code:

@Akankshaq
import java.util.*;
public class Main {
public static void main(String args[]) {
long sum = 0, n;
Scanner scn = new Scanner(System.in);
while(scn.hasNext()) {
n = scn.nextInt();
sum += n;
if(sum >= 0) {
System.out.println(n);
}
else {
break;
}
}
}
}

The sum can be zero as well.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.