PythonProgram to input decimal number and print binary of the number


x=''
n=int(input('Enter any n'))
while n>0:
  rem=n%2
  n=n//2
  x=x+str(rem)
print(x[::-1])

Comments

Some popular posts

Python Program that computes the net amount of a bank account based a transaction log from console input.