You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
231 B
Python
11 lines
231 B
Python
5 years ago
|
def convertToBinary(n):
|
||
|
"""Function to print binary number
|
||
|
for the input decimal using recursion"""
|
||
|
if n > 1:
|
||
|
convertToBinary(n//2)
|
||
|
print(n % 2,end = '')
|
||
|
|
||
|
# decimal number
|
||
|
dec = 34
|
||
|
|
||
|
convertToBinary(dec)
|