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/ Explanation:

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 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad