Python Recursive Program to Convert number in Biniary ,Octal,Hexadecimal
def to_string(n,base):
conver_tString = "0123456789ABCDEF"
if n < base:
return conver_tString[n]
else:
return to_string(n//base,base) + conver_tString[n % base]
print(to_string(2835,16))
No comments:
Post a Comment