Problem simple input 2

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
long sum = cin.nextLong(), temp = 0;
if(sum>0){
System.out.println(sum);
}
while(sum>0){
long n = cin.nextLong();
temp = sum;
sum = sum + n;
if(sum>0){
System.out.println(n);
}
}
}
}===still getiing one test case wrong not what’s the error

hi @AbhishekAhlawat1102
the sum can be equal to 0 as well you are just checking for positive sum.
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
long sum = cin.nextLong(), temp = 0;
if(sum>=0){
System.out.println(sum);
}
while(sum>=0){
long n = cin.nextLong();
temp = sum;
sum = sum + n;
if(sum>=0){
System.out.println(n);
}
}
}
}

@AbhishekAhlawat1102
please mark your doubt as resolved and rate my work

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.