Please help me find error

s-input[n-1]

what if input[n-1] will be greater than s in that case s will be negative
and you have not handle this

that’s the main error
now try at your own first
if any help needed feel free to ask

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.

Is it correct now ? Please tell me

kindly post new doubt or reopen this doubt
now I don’t have access to your question and submissions