Below formula seems working to me for converting number from base B1 to base
B2. But For intermediate operation we have to be careful, as comiler does
all operation with base 10.
 newNum = (oldNum/newBase)*oldBase + oldNum%newBase;

So
Algo,
1. Number, oldBase, newbase;
2. First convert number from oldBase to base 10, TempNumber.  [same above
formula, newBase = 10, oldBase = B1]

3. Now, Convert TempNumber from base 10 to base B2.   [same above formula,
newBase = B2, oldBase = 10] ==Number.


On Tue, Aug 17, 2010 at 9:50 PM, luckyzoner <[email protected]> wrote:

> I had proposed an algorithm of repeatedly subtracting 1 from the given
> number and subsequently adding 1 to the new number initialised to 0,
> till the given number becomes 0. However as soon as the digit reaches
> the limit , the digit becomes 0 and you add 1 to the next digit. I was
> not able to code it properly as i had to use int data type only. It
> would have been easy if the array of integers was allowed to use.
>
> Pls suggest the code for the same or some better algo.
>
> Thanx
> Lakshaya
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to