Reverse of a No

The code that is provided for the reverse of a no. fails when there are 0’s before or after first natural number.
for Eg;
if we input 1234567890
the output is 987654321
if we input 0012
the output is 21
so, my question is how can we solve this problem.one way might be to calculate the no. of digits in the number entered and run the loop for that many times but even the divison by 10 remained by 10 method fails to calculate the no. of digits.
so with the knowledge that we have and without using arrays or anything how can this issue be resolved.

if we are given 120 to reverse its output will be 21 only because starting 0’s have no significance…
if you want to print these 0’s then using an array is the best approach

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.