this is my version and i do debug but the answer come out with 49 when i entered 123 as string.
can some one please help me to correct this code?Code:int convertRec(string num) { int n = num.length(); int sum = 0; if(n == 1) return num[0]; else { sum = sum * 10 + num[0]; counter++; string number = num.substr(1,n); convertRec(number); } return sum; }