Skip to content

Commit 59527c7

Browse files
Merge pull request #1195 from SUSNATO77778888/patch-1
Create decimal to binary
2 parents eecea42 + 708241f commit 59527c7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

decimal to binary

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def decimalToBinary(num):
2+
"""This function converts decimal number
3+
to binary and prints it"""
4+
if num > 1:
5+
decimalToBinary(num // 2)
6+
print(num % 2, end='')
7+
8+
9+
# decimal number
10+
number = int(input("Enter any decimal number: "))
11+
12+
decimalToBinary(number)

0 commit comments

Comments
 (0)