One test case fail

in simple input code, in am failing the one test case can you please tell me where i am lacking in the code.

Can you send me your code

#include using namespace std; int main() { int i; int a[1000], sum=0; for(int i=0; i<1000; i++) { while(sum>=0) { cin>>a[i]; sum+=a[i]; if(sum>0) { cout<<a[i]<<endl; } else break; } } return 0; }

@Vrindasharma You are not updating the value of i. And also either use while loop or for loop. Done use both