Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

def decimal2hexa(hex):

hexaString = ""
while hex > 0:
hexa = hex % 16
hex = hex // 16
if hexa == 10:
hexa = "A"
elif hexa == 11:
hexa = "B"
elif hexa == 12:
hexa = "C"
elif hexa == 13:
hexa = "D"
elif hexa == 14:
hexa = "E"
elif hexa == 15:
hexa = "F"
hexaString = str(hexa) + hexaString
return hexaString

You might also like