num = int(input("enter a decimal number: ")) print(" binary form is ", bin(num)) print("octal form is ", oct(num)) print("hexadecimal form is ", hex(num))

enter a decimal number: 15 binary form is 0b1111 octal form is 0o17 hexadecimal form is 0xf

Python provides inbuilt functions for conversion of one number system to another.

- Convert decimal to binary using
**bin()**function. In converted binary form**0b**is - Convert decimal to octal using
**oct()**function. In converted octal form**0o**is - Convert decimal to hexadecimal using
**hex()**function. In converted hexadecimal form**0x**is

© 2018-20 Design by CseWorld Online