We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ece9591 commit 3286675Copy full SHA for 3286675
code/Integer_to_binary_conversion.py
@@ -0,0 +1,16 @@
1
+#!/usr/bin/python
2
+
3
4
+def convertToBinary( num ):
5
+ "function to convert integer to equivalent binary string"
6
+ if (num > 1):
7
+ convertToBinary(num/2)
8
+ print(int(num%2), end="")
9
+ return;
10
11
+# Getting inpts from user
12
+num = input('Enter the integer: ')
13
14
+# passing the input to convertToBinary method
15
+print('The binary equivalent of {0} is '.format(num), end='' )
16
+convertToBinary(int(num))
0 commit comments