Python Program to Convert Decimal to Binary using recursive function
- Rajesh Singh
- Oct 12, 2021
- 1 min read
def decitobin(n):
if n > 1:
decitobin(n // 2)
print(n % 2,end='')
num = int(input("Enter any decimal number: "))
decitobin(num)
Output:
Enter any decimal number: 42
>
101010>
Comments