How will we know when to stop?
Simple Input Related Problem
The idea here is to create an infinite loop, and calculate the sum inside this loop while taking inputs. As soon as the sum becomes less than 0, you can break the loop.
still gives wrong- answer on all test cases
Your code is giving wrong answer for the sample test case also. You need to print all inputs up to which the sum is greater than 0. For example, for the input:
1
2
88
-100
49
Your output : 1 2 88 -100
Correct output : 1 2 88