My output s showing correct but i am failing the test cases here.kindly help
import java.util.Scanner;
public class Simpleinput {
public static void main(String[] args)
{
int n,t,s=0;
int a[]=new int[1000];
int b[]=new int[1000];
Scanner sc = new Scanner(System.in);
System.out.println("Enter value of n");
n = sc.nextInt();
for(int i=1;i<=n;i++)
{
t=sc.nextInt();
s=s+t;
a[i]=s;
b[i]=t;
}
for(int j=1;j<=n;j++)
{
if(a[j]>0)
{
System.out.println(b[j]);
}
else
break;
}
}
}