Convert decimal to binary, octal, hexadecimal

The Decimal number system:- based on 10 digits(0,1,2,3,4,5,6,7,8,9) are used to represent a number.

The Binary number system:- based in 2 number (0,1), computer only understand binary number (0,1).

The octal number system:- based  number (0,1,2,3,4,5,6,7).
The Hexadecimal number system:- based 16 number system (0 to 9) and (A to F).

Program
n=int(input("Enter a decimal number"))
print(bin(n),"in binary")
print(oct(n),"in octal")
print(hex(n),"in hexadecimal")

Leave a Reply