We need to write a C program to convert a decimal number into its corresponding binary number.

Example: Let’s see how this can be implemented?

## Convert Binary to Decimal in C

This is the standard way of converting any binary number into its decimal form. We will do the same as depicted in the above picture i.e multiply each of the binary digits with the value of 2 raised to the power to its index (the position from right – 1 ) and sum them up.

Output ## Convert Binary to Decimal in C using Recursion

The approach in this method is the same as the above program but in a recursive way. We need to extract the last digit from the received binary number ( only when it is not a single-digit) on each recursive call then we need to multiply it with its corresponding value of 2 raised to the power its position in the original binary number from the right and sum it up with next recursive call result.

we need to eliminate the last digit from binary on next recursive call.

Output Comment below if you have any doubts or suggestions.