Simple Input - 50 % Test case Pass

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);

for(int i=0;i<5;i++)
{
	
	int n=sc.nextInt();
	int sum=0;
	//if(-1000<n && n<1000)
	//{
	sum=sum+n;
	if(sum>=0)
	{
		System.out.println(n);
	}
	else
	{
		break;
	}
	//}
}
}

}

Hi @Utkarshsingh5298291,
You need to put a while loop instead of for loop and in the while loop the condition must be while(sum>=0) or in this same for loop make the condition i<5 to sum>=0 and intialize the sum variable outside of that loop as 0.
In the question it is stated that input a new variable until the sum of all the values do not become negative while in your case you took the number of inputs to be constant as 5.Hope this helps