Given a list of numbers, stop processing input after the cumulative sum of all the input becomes negative

A list of integers to be processed

Print all the numbers before the cumulative sum become negative.

Please explain question, i am don’t understand this question.

1 Like

Start taking input one by one.Use a sum counter that will be used in the while loop to take input and set condition to take input only till sum is no negative

int s = 0;
while(s >= 0){
takeinput();
}