I'm trying to create an algorithm that converts decimals to binary. I can't use the built-in function in python to do so. This is what I've got.
n=int(input("enter a number"))
while n > 1:
print(n%2)
n //= 2
if n % 2 ==0:
print(n%2)
else:
print(n%2)
I'm completely fine with the 1's and 0's being printed in a separate line, as long as they're correct.