Test case giving wrong answer

Here is the link to my code - https://ide.codingblocks.com/s/442913

in this code , the test case 3 and 4 of spoj are not giving correct answers ;

where if we take n = 10 and elements as
0,0,100,0,0,0,0,0,0,0
the output comes out to be 610 but desired output should be 70,
is there some error??

I’m sorry there was a slight error from my side.

Hello @Vishesh-Chaitanya-1475805525886480 so is your error resolved now?

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.