Get digits of integer

If I have an integer, how to I see how many digits it is, and how to I grab single numbers from certain places? Like the number 45, how do I get that it is 2 digits, and how do I ask for the first digit to get 4 and the second digit to get 5?


The integer 45 is not the same as the number 45. The first is used for calculation, the second is only used for display and are 2 characters: '4' and '5'.

int a= 45 / 10 // a = 4 int b = 45 % 10 // b = 5

Use the same construction if you want 100, 1000, etc.

cool, thanks