not sure where program went wrong
according to 2nd test case inputs provided are
//1
// -2
//-88
//-42
//-100
and output is 1
got the same output still program is compiling with 2nd test case as wrong
package challenges;
import java.util.Scanner;
public class SimpleInput {
public static void main(String[] args) {
//Print all the numbers before the cumulative sum become negative.
int[] a=new int[1000];
int sum=0;
int las=0;
Scanner s=new Scanner(System.in);
for(int i=0;i<a.length;i++)
{
if(a[i]>-1000&&a[i]<1000) {
a[i]=s.nextInt();
}
sum=sum+a[i];
if(sum<0) {
las = i;
break;
}
}
for(int i=0;i<las;i++)
{
if( a[i]!=0)
System.out.println(a[i]);
}
}
}