In this code why my test case 1 and test case 2 are failed? Please help me

import java.util.*;
public class Main {
public static void main(String args[]) {

	Scanner sc = new Scanner(System.in);
	

	for(; ; ){
		

			int n = sc.nextInt();
			if(n<0){
				break;
			}
			else{
			System.out.println(n);
			}
			}

}

}

@LakshmiPrasanna0303 what u have to do is print the numbers till the consecutive sum is positive.what u r doing is only printing the positive numbers.correct that