What is the Problem in my code?

#include
using namespace std;
int main()
{
int n;

while(scanf("%d",&n)!=EOF)
{
    int ans = 0;
    ans = ans + n;
    
    if(ans<0)
    {
        break;
    } 
    else
    {
        cout<<n<<endl;
    }
    
}

}
INPUT
1
2
88
-2

OUTPUT
1
2
88

why?