Tuesday, November 19, 2019

Python Program to Convert Decimal to Binary Using Recursion.

# Function to print binary number using recursion
def convertToBinary(n):
   if n > 1:
       convertToBinary(n//2)
   print(n % 2,end = '')
# decimal number
dec = 34
convertToBinary(dec)
print()


No comments:
Write comments