We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents eecea42 + 708241f commit 59527c7Copy full SHA for 59527c7
1 file changed
decimal to binary
@@ -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