This code just an example. In this code if user inputs 1 digit number it works fine but if user inputs more than 1 digit number the number=number-\'0\'; code be
number=number-\'0\';