Simple input probl87

#include
using namespace std;
int main() {
int n,sum=0;
while(1)
{
cin>>n;
sum+=n;
if(sum>=0)
cout<<n<<endl;
else
break;
}

return 0;

}

what is wrong in this code??

Hi,
your code is passing all the test case in my system.Just submit it again.

Hi,
As you are not responding to the thread, I am marking your doubt as resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.

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.

No Problem with the logic