Did not get what was taught

output of the code was sum of n numbers ,but during explanation it was like ,the output should be 1234567…n.
“1”+2=12;
“12”+3=123;
and so on ,then why the output was 1+2+3+4+…+n.

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.