Simple Test Challenge

I am unable to solve all test challenges of this challenge. I am able to solve only test case 1 and 4.please help to solve all test cases.For my code compiler give wrong answer message for test case 2 and 3.

@naazsayma123 hey,just take input of no and add that number to sum and if sum <0 stop taking input.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.