Division and Sum Digits
excerpt: This covers the basic building blocks such as reduction and counter. tags: input-value-reduction-by-subtraction counter modulo-operator integer-division input-value-reduction-by-division chop-rightmost-digit
Implement a method to perform integer division, it must divide two given numbers.
Division
|
|
The key insight to solve this problem is that division is repeated subtraction.
Building Blocks
- Reduce Input Value by Subtraction
- Counter
Sum Digits
Write a method to sum the digits in a number.
|
|
Extract rightmost digit using integer division. The value is reduced by chopping off the rightmost digit.
Building Blocks
- Modulus
- Integer Division
- Reduce Input Value by Division