Suppose i have an 8 digit code. I want to assign first 'x' digits to represent the first code. The 'y' digits after x i want to represent a different code. And so on.

So for a specified number. I want the first three digits to give value to a variable. The next three to do the same to another variable. And the second last and last to both individually do the same.

For the first three, i would:

divide the number by 100,000. This would yield a three digit code with 5 decimals. Then i would convert the double into integer, and end up with a three digit code (called "number1") which i evaluate via if statements.

For the next three:

Divide the number by 100. This would create a 6 digit number with 2 decimals. I convert into integer, creating a 6 digit integer (this is "number6". Then subtract number6 - 1000*number1. This would produce a the three digits after the first three. So in 12345678, these numbers would be 456.

However, im not sure how to do the second last and last! I was thinking of using remainders, but im unsure of how to do that.

Please, any help or suggestions would be strongly appreciated.