Answer:
print("Enter a positive whole number: ")
NumberIn = int(input())
NumberOut = 0
Count = 0
while NumberIn > 0:
Count = Count + 1
PartValue = NumberIn % 2
NumberIn = NumberIn // 2
for i in range(1, Count - 1):
PartValue = PartValue * 10
NumberOut = NumberOut + PartValue
print("The result is: " + str(NumberOut))
Outputs:
Enter a positive whole number:
22
The result is: 1011
Enter a positive whole number:
29
The result is: 1111
Enter a positive whole number:
-1
The result is: 0