one of the test case failed
please point out where i am dping mistakes
Simple input doubt
if sum is zero then also you have to print the n
Correct Code
#include<iostream>
using namespace std;
int main()
{
int n,sum=0;
while(1)
{
cin>>n;
sum=sum+n;
if(sum>=0)
{
cout<<n<<endl;
}
else
break;
}
return 0;
}
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.