Welcome to Code Helper

Conversion of Decimal to Binary



➣ Source Code

 
		   
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)
	
		 
		

➣ Output

 
110100
		
	
 BACK 
Made with ❤