Write a program that prompts the user to input a decimal integer and display its binary equivalent.
Source Code
number = int(input("Enter a positive number: "))
binary = 0
place = 1
n = number
while n > 0:
remainder = n % 2
binary = binary + remainder * place
place = place * 10
n = n // 2
print("Binary representation of", number, "is", binary)
Output
Enter a positive number: 12
Binary representaion of 12 is 1100