Python Program to Convert Decimal to Binary, Octal and Hexadecimal

Spread the love

In this article, You will learn how to write python program to Convert Decimal to Binary, Octal and Hexadecimal
In python we have inbuilt functions bin(), Oct(), hex(). We write program with the help of those functions.

#Convert decimal to binary value

dec = 522 print("The binary value is",bin(dec))


#Convert decimal to octal value

dec = 522 print("The Octal Value is",oct(dec))


#Convert Decimal value to hexadecimal
dec = 522 print("The Hexdecimal Value is",hex(dec))




Leave a Reply

Your email address will not be published. Required fields are marked *