Convert Decimal to Binary, Octal and Hexadecimal Python

PROGRAM TO CONVERT DECIMAL TO BINARY, OCTAL AND HEXADECIMAL


dec = 344

print("The decimal value of", dec, "is:")
print(bin(dec), "in binary.")
print(oct(dec), "in octal.")
print(hex(dec), "in hexadecimal.")

OUTPUT
The decimal value of 344 is:
0b101011000 in binary.
0o530 in octal.
0x158 in hexadecimal.

Comments

Popular posts from this blog

Solve the Sudoku Python

Solve the Sudoku Java

Find Duplicates Java