I'm making a standard form calculator (e.g. 7 x 10^5) and I need help thinking of the best method to use.
I basically need the program to take the number/input (say 70000) and then see what multiple of 10 it divides by to give a number between 1 and 9. Like this;
If Input / 1 = 1 or 2 ... or 9 then
output = 0
elseif input / 10 = 1 or 2 ... or 9 then
output = 1
elseif input / 100 = 1 or 2 ... or 9 then
output = 2
(Then, if nothing satisfies...)
if input * 10 = 1 or 2 ... or 9 then
output = -1
I need it to do this and work it out for any size number. What's the best method for this? Some sort of array?
Thanks.