String to Integer

The code is giving the wrong output. Where am I going wrong?
Code : https://ide.codingblocks.com/s/202570

@Chirag-Jain-1414278322030453


I have made some minor changes in the code, now it works fine.
You were taking s[i], it contains its ascii value and not numeric value, You subtract ‘0’ to get its numeric value