Hello forum. I am confused. I am writing a method that takes in a int value and a base and from those two find the base number . For example: The method takes a number, say 342, and converts it to a base (any base).
I understand the algorithm, cant fathom the code
Heres what I know
value % base = first digit starting from right
(value/base) % base = second digit starting from the right
(value/base^2)% base = third digit starting from right...
,... and so forth.
I am not sure how to write this loop. I was thinking a while...I cant see this. Can some one help me better understand how to loop this? THanks in advance
Re: Base conversion
Get some paper and pencil and go through the algorithm by hand. You should notice a repetitive pattern. Also, do this when converting decimal to decimal. It might make it easier to visualize.