Programming Examples
Python program to convert decimal into other number systems
Python program to convert decimal into other number systems
Solution
num = int(input("Enter any Decimal Number : "))
print("The decimal value of", num, "is:")
print(bin(num), "in binary.")
print(oct(num), "in octal.")
print(hex(num), "in hexadecimal.")
Output
Enter any Decimal Number : 25
The decimal value of 25 is:
0b11001 in binary.
0o31 in octal.
0x19 in hexadecimal.