Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int sum=0;
while(sum>= 0) {
if(sum>=0)
System.out.println(n);
n = sc.nextInt();
sum += n;
}
What is the problem in my code
corrected code:
please mark your doubt as resolved 
It is giving me 75/100 there is something wrong in the code
What is the error in my code ?
what is wrong with my code ??
Hey @ParagKumar
you need to take input this till sum doesnt become negative and has input
so you can do this using do while
or you can just add while (sum >= 0 && scn.hasnext)
this way the code will be :https://ide.codingblocks.com/s/457805
you can debug and see for this input
1
2
88
-89
49
if this solves your doubt please mark it as resolved 
