Count Length of a Number
excerpt: This covers the basics of counter and reducing input value by integer division. tags: while-loop reducing-value-by-integer-division counter
Write a method to count the length of a given number. The implementation:
|
|
The integer division can be used to chop off the rightmost digit from the given input.
Building Blocks
- while Loop
- Reduction of Input Value
- Reducing Value by Integer Division
- Counter