Saturday, November 19, 2011

An Algorithm to convert Decimal to any base



B=2 #base
place = 0
digit=[]
number = 105 #number to be converted

while (number > 0 )
{
digit[place] = number mod B
number = number div B
place = place + 1
} loop here

print digit[]

Write a python code for this


No comments:

Post a Comment