Skip to content

Commit

Permalink
Create decimal to binary
Browse files Browse the repository at this point in the history
it will convert all decimal numbers to binary
  • Loading branch information
SUSNATO77778888 authored Oct 21, 2020
1 parent 8682a38 commit 708241f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions decimal to binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def decimalToBinary(num):
"""This function converts decimal number
to binary and prints it"""
if num > 1:
decimalToBinary(num // 2)
print(num % 2, end='')


# decimal number
number = int(input("Enter any decimal number: "))

decimalToBinary(number)

0 comments on commit 708241f

Please sign in to comment.