Test cases failed

link to my code-https://ide.codingblocks.com/s/66056
link to question-https://online.codingblocks.com/player/16974/content/4693

in my code problem is that it output the number until sum>0, but if suppose the digit u enter the last number which is big and it makes the total sum +ve it output that number too which it should not .
for ex-input are 1,2,88,-100,1212
my output is -1,2,88,1212 instead of this it should be 1,2,88…only.

@shubhamshagy i have corrected your code you can refer this.

thanks,that was stupid mistake,

there is one problem in this code u have written ,i ran it in my pc (codeblocks),the moment sum becomes less than zero ,the whole code stops,i dont know how it is running in coding blocks ide

@shubhamshagy there is no error could you please provide your test case. i already apply a check if sum is greater or equal to zero then you can only print else you have to break

there is no condition for terminating the while loop that is
loop is nerver going to be -1 as nothing is changing it
there fore make a condition that terminate tje loop

@phantom could please elaborate more what you trying to say

Hi, this is the correct code https://ide.codingblocks.com/s/66065. Basically, you need to put an infinite loop, add the new number to the previous sum, if the sum is positive print the current number, otherwise, break the loop.

i mean the while loop is irrevalent there just use if else

how is it possible it is running stream you have to choose while loop. if you have any other option please mention it.

i mean inner while loop see this https://ide.codingblocks.com/s/66197

Hi Sharad, that is what has been done in the code we shared above. An infinite while loop and an if-else condition inside it to break the while loop.