Write a program to Convert Decimal to Binary, Octal and Hexadecimal in Python
Code:
1 2 3 4 5 6 7 8 9 10 11 |
# Python program to convert decimal number into binary, octal and hexadecimal number system # Change this line for a different result dec = int(input("Enter a decimal number ")) print("The decimal value of",dec,"is:") print(bin(dec),"in binary.") print(oct(dec),"in octal.") print(hex(dec),"in hexadecimal.") |