What is with this code why its not printing negative number

#include<bits/stdc++.h>
using namespace std;
int main() {

int i;
cin>>i;
int n=0;

int sum=0;

while(n<i){
    cin>>n;
	sum=sum+n;
	
if(n>-1000 && n<1000){
	if(sum>=0){
		cout<<n<<endl;
	}else{
		break;
	}
}
n=n+1;
}

return 0;

}

hi @discobot,
correctedhttps://ide.codingblocks.com/s/677008

Hi! To find out what I can do, say @discobot display help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.