How to change bases?
|
04-08-2019, 12:44 AM
Post: #4
|
|||
|
|||
RE: How to change bases?
(04-07-2019 02:45 PM)kevin3g Wrote: Say I have a number in base 3 and want to convert it to base 6 or any base conversion. How would I do this?There may be a better way, but whenever I have written a base conversion program to convert from one base to another, if neither base is 10, I first convert the number to base 10, then to the other base. To convert base 3 number to base 10, multiply digits by corresponding powers of 3 and add. To convert base 10 number to base 6, for example, divide the base 10 number by 6 and save the remainder, then divide the quotient by 6 and save the remainder, and repeat until quotient is 0. When you "save the remainders," first one is the rightmost digit of your answer. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 7 Guest(s)