Is this for a programming exercise? I don't know of a simple math function that does it, but if this is for programing you need to use modulus (% in C++ and Java) and integer division (/ in Java and C++), and a while loop. The number %10 will give you the last digit. The number /10 will remove the last digit from the number. See if you can figure it out.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.