Question: use java Write a converter to convert a base 10 number to base 8 and then display it. Make sure there is no multiplication or
use java
Write a converter to convert a base 10 number to base 8 and then display it. Make sure there is no multiplication or string concatenation in your implementation.
To convert a base 10 number to base 8, you need to apply a sequence of mod 8, div 8 operations.
For example, to convert 215 to base 8,
| Step 1 | 215 % 8 = 7 | 215 / 8 = 26 |
| Step 2 | 26 % 8 = 2 | 27 / 8 = 3 |
| Step 3 | 3 % 8 = 3 | 3 / 8 = 0 Stop |
Collect the result of the mod in the reverse order, and the answer is 327.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
