please check my code. it is question problem from
challenges-fundamentals simple input
Https://ide.codingblocks.com/s/250454
The approach you are using is wrong… You need to use a while loop here as :
while(cumulative_sum>=0)
{
cin>>n;
cumulative_sum= cumulative_sum+n;
if(cumulative_sum>=0)
{
cout<<n<<endl;
}
else
if(cumulative_sum<0)
{
return 0;
}
}