Why not give a hint:

You know how to get the last digit by modulo.

How much is 345 / 10 (all values integer, including the result!)? If you don't know the answers debug it. And after that think again what you already know about modulo.

And so on and on and on for the other digits.

And after swapping the right digits recalculate your number d1 + d2 *10 + d3 *100 + .... Of course you will do that in a loop.

Regards.

15,065,914 members