Loading, please wait...

Binary Conversion

Python Program to Convert Decimal to Binary and Octal and Hexadecimal

 

Code:

dec = 152
print("The decimal value of",dec,"is:")
print(bin(dec),"in binary.")
print(oct(dec),"in octal.")
print(hex(dec),"in hexadecimal.")

 

Then, Click on the run button.