I need to code a function that takes a number, and if it's not negative or zero (if it's zero then the function quits), it checks if it's digits are rising from left to right (123, for example), and if they are, it prints it.

One problem I have with this is that if I knew the number had only 3 digits then I would divide it by 10, 100, 1000 and check those three numbers, but I don't know how many digits will be in the number the user types in, so I don't know what to do with that.

Can anyone help me with this?