Concept

How can a while loop normalize a number by repeatedly dividing it by 10?

ComputerScienceOne / Normalizing a Number

"Let’s revisit the example from Section 4.1.1 in which we normalize a number by continually dividing it by 10 until it is less than 10. The code in Code Sample 28.7 specifically refers to the value 32145.234 but would work equally well with any value of x.\n\ndouble x = 32145.234;\n\nint k = 0;\n\nwhile(x > 10) {\n\nx = x / 10; //or: x /= 10;\n\nk++;\n\n}\n\nCode Sample 28.7.: Normalizing a Number with a While Loop in Java"

Related Ideas

How can a while loop normalize a number by repeatedly dividing it by 10? | ComputerScienceOne | Bifalgorithm | Bifalgorithm