Answer to Question #185507 in Python for Woyengimiesindo Malati

Question #185507

Write a program that reads a number and prints all of its binary digits: Print the remainder

number % 2, then replace the number with number / 2. Keep going until the number is 0. For 

example, if the user provides the input 13, the output should be

1


1

1


1
Expert's answer
2021-04-29T17:28:59-0400
number = int(input("number = "))


while number!=0:
    print(number%2)
    number//=2

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS