Convert Binary to Decimal in C

Here you will get program to convert binary to decimal in C.

We can obtain a decimal number by multiplying each digit of binary number with power of 2 and adding each multiplication result. The power starts from 0 and goes to n-1 where n is the total number of digits in binary number.

Below is the program to implement this in C.

Convert Binary to Decimal in C

 

Output

Enter any binary number: 111

The decimal conversion of 111 is 7

1 thought on “Convert Binary to Decimal in C”

  1. I need a C code to convert Binary to BCD and vice versa. But code should be with explanation as I am new to programming. Please need your help.

Leave a Comment

Your email address will not be published. Required fields are marked *