And this is what I got so far.....
decimal = eval(input("Enter an integer: "))
n = decimal
while n != 0:
if n % 16 == 10:
hexadecimal = 'A'
elif n % 16 == 11:
hexadecimal = 'B'
elif n % 16 == 12:
hexadecimal = 'C'
elif n % 16 == 13:
hexidecimal = 'D'
elif n % 16 == 14:
hexadecimal = 'E'
elif n % 16 == 15:
hexadecimal = 'F'
else:
hexadecimal = n % 16
hexadecimal = hex(n)
print("The", str(n) + "its corresponding to", hexadecimal)
For example decimal of 15 will be F (hex)
29 will be 1D (hex)
Apparently, my code is not working.
can anyone help!

New Topic/Question
Reply



MultiQuote




|