Menu Close

Convert number into binary, octal and hexa

Chris was given a task by his friend rajesh. When rajesh tells a number then chris needs to convey the value in binary, octal, hexadecimal for the decimal equivalent value told by his friend rajesh.

Help them to achieve this task.

Number=int(input('Enter a integer value: '))
print("The Binary Value {}".format(bin(Number)))
print("The octal Value {}".format(oct(Number)))
print("The hexadecimal Value {}".format(hex(Number)))



'''
INPUT
        Enter a integer value: 344
OUTPUT
	The Binary Value 0b101011000
	The octal Value 0o530
	The hexadecimal Value 0x158

INPUT
        Enter a integer value: 25
OUTPUT
	The Binary Value 0b11001
	The octal Value 0o31
	The hexadecimal Value 0x19
'''

Output:
Enter a integer value: 344
The Binary Value 0b101011000
The octal Value 0o530
The hexadecimal Value 0x158

Output:
Enter a integer value: 25
The Binary Value 0b11001
The octal Value 0o31
The hexadecimal Value 0x19

Output:
Enter a integer value: 65
The Binary Value 0b1000001
The octal Value 0o101
The hexadecimal Value 0x41

Output:
Enter a integer value: 10
The Binary Value 0b1010
The octal Value 0o12
The hexadecimal Value 0xa

Output:
Enter a integer value: 2
The Binary Value 0b10
The octal Value 0o2
The hexadecimal Value 0x2


More Codes to Fcuk