pls see it is failing in some of the test cases
ide link:
Print input failing in some test cases
declare sum=0 outside loop
otherwise every time sum will starts with 0 which is wrong
after declaring outside loop
now also showing that faied in some test cases
Modified Code
2 mistakes
- declare sum=0 outside loop
-
if(sum<=0){ break; } instead of this correct one is if(sum<0){ break; }
see the modified code
i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course
1 Like