Simple input question

what is wrong in this code for question “simple input” in c++.
#include
using namespace std;
int main() {
int a,i,sum=0;
for(i=1;i!=0;i++)
{
cin>>a;
sum=sum+a;
if(sum<0)
{
break;
}
else if(sum>0)
{
cout<<a<<endl;
}
}
}

Hi @manudeep_21
In this ques you have to print input till sum>=0. So in the else if condition just add = sign and then all your test cases will pass.

If your doubt is clear then mark it as resolved.