# Python Program To Convert a Number From Decimal to Binary Hey Shouters!! Today we have come up with the Decimal to binary number program in python.

In this blog, we will see programs to convert decimal number to an equivalent binary number. But if you are a beginner and do not know how to write programs in Python. Check it first Introduction to Python.

We will see two Python programs in this blog that will convert a number in the decimal number system to the binary number system.

1. Using User Defined Function
2. Using In-built Function

## 1. Decimal To Binary Using User Defined Function-

In this program we have defined a function declToBin() for the conversion. This function takes the decimal number as an input parameter and converts it into an equivalent binary number.

In this program, we take the input from the user and then call the function and then will recursively call the function to get the binary equivalent as mentioned in the program below.

Output:
Enter the decimal number: 44
101100

## Python program to convert decimal number to binary using bin()-

In this program, we are using an in-built function bin() to convert the decimal number to binary.

The function just takes the decimal number input from the user and then the function calculates the binary and returns the binary equivalent.

Output:

Enter the decimal number: 34
Equivalent Binary Number: 100010

Please comment down your codes that you used for decimal to binary number in python.

If you are preparing for Campus Placement and want to learn more about the Online Tests and get the basic tips and tricks that are required. Please check our Instagram handle Shout Coders.

## Recommended Posts-

#### You may have missed 