Calculate the 1 in a value

20 Views Asked by At

I am getting different values from a computer program that I designed. I then want to formulate an algorithm to calculate the 1th value below it (and I'm not really sure the terminology for this so bear with me).

Examples if I have:
43535 the result = 10000,
76765 = 10000,
5674 = 1000,
344 = 100,
56 = 10,
8 = 1,
0.435 = 0.1, etc.

If someone could educate me a little that would be most appreciated!

1

There are 1 best solutions below

0
On BEST ANSWER

These numbers are called powers of ten.
To decide which one, calculate M=floor(log(N)/log(10)).
Lastly, if you want, calculate 10^M.