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.

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2024 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz