#include
using namespace std;
int main() {
int n;
int s=0;
for (int i=0;i<=n;i++)
{
cin>>n;
s=s+n;
if (s<0)
{
break;
}
cout<<n<<endl;
}
return 0;
}
#include
using namespace std;
int main() {
int n;
int s=0;
for (int i=0;i<=n;i++)
{
cin>>n;
s=s+n;
if (s<0)
{
break;
}
cout<<n<<endl;
}
return 0;
}
@architsuryavanshi,
Please use Coding Blocks IDE to share codes, don’t just copy/paste here.
Also, you need to take the complete input, only then you can print your answer, not before. So, input the whole list of integers, then calculate and print the answer.