# Python Program to Convert Decimal to Binary Using Recursion

In this example, we will write a recursive function to convert decimal to binary. To better understand this example, make sure you have knowledge of the following tutorials:-

## Python Program to Shuffle Deck of Cards

def binary(n):
if n > 1:
binary(n // 2)
print(n % 2, end = '')

# Take decimal number from user
dec = int(input("Enter an integer: "))
binary(dec)

The output of the above program is:-

Enter an integer: 20
10100