# Thread: Check certain positions of an int?

1. ## Check certain positions of an int?

This is possibly a very basic question, but how to check the second or third value of of an int variable? Am I supposed to use on of them string functions or is there a simpler way?

2. What do you mean by sting functions on an int ?
Also, yes getting the third or fourth position is as simple as reaching the third or fourth digit which you should know how to do from math class.

3. I am trying to write a function that checks certain positions of an int and the value of it. I would like to know how to do this. And what do you mean with math class?

4. What I meant was that there is a simple formula to get each digit of an int. Think about it, its pretty easy actually.

Supposing your number was 100
then the hundredths place digit is 1
and the tenths place digit is 0
and the digit at the ones place is 0

Now how would you write a program to do that ?

5. Ok got it, Modulus did the trick. thx for the wink in the right direction.

Popular pages Recent additions