This is not printing all terms till all terms sum become zero, som extra term is add in evry new input

hey @balram, your code is working fine. I gave a sample input for length=10
Input: 1 2 3 4 5 -100 6 7 8 9
Output: 1 2 3 4 5