How can I use "Math." To find the location of a digit in a large integer number? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I use "Math." To find the location of a digit in a large integer number?

I am trying to figure out how for example do I find the digit at location "2" (from the right! without 0) such as: In the number 12345 digit number 2 is 4. (in this specific problem) but how do I do it? Couldn't find a solution!

10th Nov 2017, 6:46 PM
Oz Ben Shaul
1 Answer
0
Hey, thanks but I managed figured it out! I used: value = value / (int)Math.pow(10, location - 1) % 10 and it gave the index value.
11th Nov 2017, 1:04 PM
Oz Ben Shaul