Given a list of numbers, stop processing input after the cumulative sum of all the input becomes negative

import java.util.Scanner;

public class sum {

public static void main(String[] args)
{
	Scanner sc=new Scanner(System.in);
	int n=sc.nextInt();
	int arr[]=new int [n];
	for(int i=0;i<arr.length;i++)
	arr[i]=sc.nextInt();
	for(int i=0;i<arr.length;i++)
	{
		if(arr[i]<0)
		break;
		else
		System.out.println(arr[i]);
	}
}

}

sir whats wrong in this code

when i get reply already 2 days go bad service by coding blocks