MY CODE IS GIVING CORRECT OUTPUT .BUT FAILING TEST CASES

MY CIDE URL IS;- https://ide.codingblocks.com/s/580735

PLZ SEE IT ,IT IS WORKING PROPERLY ,SIR PLZ MAKE SOME CHANGES IN IT SO THAT IT PASS ALL THE TEST CASES.

@chhabrarishi2001_264ecb7697e8af2a you are taking 0 as maximum what if the array contains all negative elements then your code will answer zero and ans need to be min element in the array
and also use long long to avoid integer overflow and size of array should be n not 1000 i have changed the code a little bit
Coding Blocks IDE
if dout clear rate my experience and if not feel free to ask further

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.